oauth.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ====================
  2. Integrating OAuth
  3. ====================
  4. Introduction
  5. ==============
  6. As of v0.8.5, Netmaker offers integration with the following OAuth providers:
  7. - GitHub
  8. - Google
  9. - Microsoft Azure AD
  10. By integrating with an OAuth provider, your Netmaker users can log in via the provider, rather than the default simple auth.
  11. Configuring your provider
  12. ===========================
  13. In order to use OAuth, configure your OAuth provider (GitHub, Google, Azure AD).
  14. You must configure your provider (except for Azure AD) to use the Netmaker Dashboard URI dashboard.<netmaker.base.domain> as the origin URL.
  15. For example: `https://dashboard.netmaker.mydomain.com`
  16. You must configure your provider to use the Netmaker API URI redirect route with the following format: https://api.<netmaker base domain>/api/oauth/callback.
  17. For example: `https://api.netmaker.mydomain.com/api/oauth/callback`
  18. General provider instructions can be found with the following links:
  19. Instructions for GitHub: https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#github-auth-provider
  20. Instructions for Google: https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#google-auth-provider
  21. Instructions for Microsoft Azure AD: https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#microsoft-azure-ad-provider
  22. Configuring Netmaker
  23. ======================
  24. After you have configured your OAuth provider, take note of the CLIENT_ID and CLIENT_SECRET. If you are using Azure for oauth, you may also want to note down the Azure tenant ID you wish to use.
  25. Next, Configure Netmaker with the following environment variables. If any are left blank, OAuth will fail.
  26. .. code-block::
  27. AUTH_PROVIDER: "<azure-ad|github|google>"
  28. CLIENT_ID: "<client id of your oauth provider>"
  29. CLIENT_SECRET: "<client secret of your oauth provider>"
  30. SERVER_HTTP_HOST: "api.<netmaker base domain>"
  31. FRONTEND_URL: "https://dashboard.<netmaker base domain>"
  32. AZURE_TENANT: "<only for azure, you may optionally specify the tenant for the OAuth>"
  33. After restarting your server, the Netmaker logs will indicate if the OAuth provider was successfully initialized:
  34. .. code-block::
  35. sudo docker logs netmaker
  36. Once successful, users can click the key symbol on the login page to sign-in with your configured OAuth provider.
  37. .. image:: images/oauth1.png
  38. :width: 80%
  39. :alt: Login Oauth
  40. :align: center
  41. Configuring User Permissions
  42. ===============================
  43. All users logging in will have zero permissions on first sign-in. An admin must configure all user permissions.
  44. Admins must navigate to the "Users" screen to configure permissions.
  45. For each user, an admin must specify which networks that user has access to configure. Additionally, an Admin can elevate a user to Admin permissions.
  46. .. image:: images/oauth3.png
  47. :width: 80%
  48. :alt: Edit User 2
  49. :align: center
  50. .. image:: images/oauth2.png
  51. :width: 80%
  52. :alt: Edit User
  53. :align: center