|
| 1 | +// Metadata created by nebel |
| 2 | + |
| 3 | +[id="registry-security-azure_{context}"] |
| 4 | + |
| 5 | += Configuring {registry} authentication and authorization with Microsoft Azure Active Directory |
| 6 | + |
| 7 | +[role="_abstract"] |
| 8 | +This section explains how to manually configure authentication and authorization options for {registry} and Microsoft Azure Active Directory (Azure AD). |
| 9 | + |
| 10 | +The {registry} web console and core REST API support authentication in Azure AD based on OpenID Connect (OIDC) and the OAuth Authorization Code Flow. {registry} provides role-based authorization for default admin, write, and read-only user roles. {registry} authentication and authorization settings are disabled by default. |
| 11 | + |
| 12 | +To secure {registry} with Azure AD, you require a valid directory in Azure AD with specific configuration. This involves registering the {registry} application in the Azure AD portal with recommended settings and configuring environment variables in {registry}. |
| 13 | + |
| 14 | +.Prerequisites |
| 15 | +* Azure AD is installed and running. For more details, see the link:https://learn.microsoft.com/en-us/azure[Microsoft Azure AD user documentation]. |
| 16 | +* {registry} is installed and running. |
| 17 | + |
| 18 | +.Procedure |
| 19 | + |
| 20 | +. Log in to the Azure AD portal using your email address or GitHub account. |
| 21 | + |
| 22 | +. In the navigation menu, select *Manage > App registrations > New registration*, and complete the following settings: |
| 23 | ++ |
| 24 | +** *Name*: Enter your application name. For example: `apicurio-registry-example` |
| 25 | +** *Supported account types*: Click *Accounts in any organizational directory*. |
| 26 | +** *Redirect URI*: Select *Single-page application* from the list, and enter your {registry} web console application host. For example: `\https://test-registry.com/ui/` |
| 27 | ++ |
| 28 | +IMPORTANT: You must register your {registry} application host as a *Redirect URI*. When logging in, users are redirected from {registry} to Azure AD for authentication, and you want to send them back to your application afterwards. Azure AD does not allow any redirect URLs that are not registered. |
| 29 | + |
| 30 | +. Click *Register*. You can view your app registration details by selecting *Manage > App registrations* > *apicurio-registry-example*. |
| 31 | + |
| 32 | +. Select *Manage > Authentication* and ensure that the application is configured with your redirect URLs and tokens as follows: |
| 33 | +** *Redirect URIs*: For example: `\https://test-registry.com/ui/` |
| 34 | +** *Implicit grant and hybrid flows*: Click *ID tokens (used for implicit and hybrid flows)* |
| 35 | + |
| 36 | +. Select *Azure AD > Admin > App registrations > Your app > Application (client) ID*. For example: `123456a7-b8c9-012d-e3f4-5fg67h8i901` |
| 37 | + |
| 38 | +. Select *Azure AD > Admin > App registrations > Your app > Directory (tenant) ID*. For example: `\https://login.microsoftonline.com/1a2bc34d-567e-89f1-g0hi-1j2kl3m4no56/v2.0` |
| 39 | + |
| 40 | +. In {registry}, configure the following environment variables with your Azure AD settings: |
| 41 | ++ |
| 42 | +.Configuration for Azure AD settings in {registry} |
| 43 | +[.table-expandable,width="100%",cols="6,4,6",options="header"] |
| 44 | +|=== |
| 45 | +|Environment variable |
| 46 | +|Description |
| 47 | +|Setting |
| 48 | +|`KEYCLOAK_API_CLIENT_ID` |
| 49 | +|The client application ID for the {registry} REST API |
| 50 | +|Your Azure AD Application (client) ID obtained in step 5. For example: `123456a7-b8c9-012d-e3f4-5fg67h8i901` |
| 51 | +|`REGISTRY_OIDC_UI_CLIENT_ID` |
| 52 | +|The client application ID for the {registry} web console. |
| 53 | +|Your Azure AD Application (client) ID obtained in step 5. For example: `123456a7-b8c9-012d-e3f4-5fg67h8i901` |
| 54 | +|`REGISTRY_AUTH_URL_CONFIGURED` |
| 55 | +|The URL for authentication in Azure AD. |
| 56 | +|Your Azure AD Application (tenant) ID obtained in step 6. For example: `\https://login.microsoftonline.com/1a2bc34d-567e-89f1-g0hi-1j2kl3m4no56/v2.0`. |
| 57 | +|=== |
| 58 | + |
| 59 | +. In {registry}, configure the following environment variables for {registry}-specific settings: |
| 60 | ++ |
| 61 | +.Configuration for {registry}-specific settings |
| 62 | +[.table-expandable,width="100%",cols="6,5,4",options="header"] |
| 63 | +|=== |
| 64 | +|Environment variable |
| 65 | +|Description |
| 66 | +|Setting |
| 67 | +|`REGISTRY_AUTH_ENABLED` |
| 68 | +|Enables authentication for {registry}. |
| 69 | +|`true` |
| 70 | +|`REGISTRY_UI_AUTH_TYPE` |
| 71 | +|The {registry} authentication type. |
| 72 | +|`oidc` |
| 73 | +|`CORS_ALLOWED_ORIGINS` |
| 74 | +|The host for your {registry} deployment for cross-origin resource sharing (CORS). |
| 75 | +|For example: `\https://test-registry.com` |
| 76 | +|`REGISTRY_OIDC_UI_REDIRECT_URL` |
| 77 | +|The host for your {registry} web console. |
| 78 | +|For example: `\https://test-registry.com/ui` |
| 79 | +|`ROLE_BASED_AUTHZ_ENABLED` |
| 80 | +|Enables role-based authorization in {registry}. |
| 81 | +|`true` |
| 82 | +|`QUARKUS_OIDC_ROLES_ROLE_CLAIM_PATH` |
| 83 | +|The name of the claim in which Azure AD stores roles. |
| 84 | +|`roles` |
| 85 | +|=== |
| 86 | ++ |
| 87 | +NOTE: When you enable roles in {registry}, you must also create the same roles in Azure AD as application roles. The default roles expected by {registry} are `sr-admin`, `sr-developer`, and `sr-readonly`. |
| 88 | + |
| 89 | + |
| 90 | +[role="_additional-resources"] |
| 91 | +.Additional resources |
| 92 | +* For details on configuring non-default user role names, see xref:registry-security-settings_{context}[]. |
| 93 | +* For more details on using Azure AD, see the link:https://learn.microsoft.com/en-us/azure[Microsoft Azure AD user documentation]. |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
0 commit comments