-
Notifications
You must be signed in to change notification settings - Fork 16
NOM-7 SSO documentation #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexnb
wants to merge
31
commits into
neo4j:dev
Choose a base branch
from
alexnb:alexnb/sso
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
b8b572e
wip
alexnb 926d058
don't take ids from neo4j tenant
alexnb 57201d2
wip
alexnb 8dd1a78
wip
alexnb 6a571ed
wip
alexnb 82fa68b
wip
alexnb b558af1
added audience option
alexnb 2bd43fa
improved description
alexnb 6b4d20b
document custom fields
alexnb 4593749
fix option name
alexnb 6fd8923
corrections from review
alexnb 15cbc1b
generalize Entra ID setup requirements (concrete steps moved to a Goo…
alexnb 6ca63ed
don't make link out of the callback URL
alexnb 4736280
consistent naming of things
alexnb 04d7779
suggestions from review
alexnb bcdfcd4
made non-links unclickable
alexnb 5ceac58
add Okta Integration docs
ravikiran-sulikeri 712482b
remove yarn added change
ravikiran-sulikeri ee693af
Apply suggestion from @alexnb
alexnb cd35042
Apply suggestion from @alexnb
alexnb dbe8b33
Apply suggestion from @alexnb
alexnb 2b3bd27
Apply suggestion from @alexnb
alexnb 8010e51
Apply suggestion from @alexnb
alexnb 4d69f99
Apply suggestion from @alexnb
alexnb e809c31
Apply suggestion from @alexnb
alexnb 9c8fe53
Apply suggestion from @alexnb
alexnb 52aef65
Apply suggestion from @alexnb
alexnb 39e1d71
Apply suggestion from @alexnb
alexnb 744afde
Apply suggestion from @alexnb
alexnb d551c86
Apply suggestion from @alexnb
alexnb 582d527
added expression examples
alexnb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| = Configuration | ||
| :description: This section describes the configuration steps to enable Single Sign-On (SSO) for NOM server | ||
|
|
||
| == Overview | ||
|
|
||
| NOM supports SSO for authentication using external Identity Providers (IdP) that support OAuth2/OIDC implicit authentication flow. | ||
| Currently, Microsoft Entra ID (formerly Azure Active Directory), Google Identity and Okta are supported. | ||
| More IdP types and alternative authentication flows may be added in future NOM releases. | ||
| SSO can be used as the only authentication method or in combination with username/password login. | ||
| When both methods are enabled, users can choose the login method on the NOM login page. | ||
|
|
||
| == Configuration | ||
|
|
||
| One or more SSO configs can be set up containing the options needed to perform SSO authentication with an external Identity Provider (IdP). | ||
|
|
||
| Configurations are identified by a name, which is used to reference the configuration in the environment variable names or command line arguments. | ||
| The name can be freely chosen, but must consist only of alphanumeric characters. | ||
|
|
||
| The configuration contains options needed to obtain, validate and map access tokens to SSO users in NOM, including assigning NOM roles to SSO users. | ||
|
|
||
| Only the options needed for obtaining the token are sent to the frontend. | ||
|
|
||
| Configurations are validated during the startup of NOM server. | ||
| If a configuration is invalid, the errors are reported in the logs. | ||
|
|
||
| === Common options | ||
|
|
||
| [cols="<,<,<, <",options="header"] | ||
| |=== | ||
| | Command line argument | ||
| | Environment variable name | ||
| | Description | ||
| | Example value | ||
|
|
||
| | `app.sso.active-configurations` | ||
| | `APP_SSO_ACTIVE_CONFIGURATIONS` | ||
| | Lists comma-separated names of configurations that should be offered as login options on the NOM login page. | ||
| | `myConfig1,myconfig2` | ||
|
|
||
| | `app.username-password-login.enabled` | ||
| | `APP_USERNAME_PASSWORD_LOGIN_ENABLED` | ||
| | Username/password login can be enabled or disabled, enabling SSO login either be offered additionally or to be the only login method. | ||
| If disabled, the pages "NOM Administrators" and "Profile" will not be available in the NOM UI. | ||
| | `false` | ||
| |=== | ||
|
|
||
| In the reference below, the placeholder `<CONFIG>` is used to indicate where the configuration name should be used (e.g. "myConfig1"). | ||
|
|
||
|
|
||
| [cols="<,<,<, <",options="header"] | ||
| |=== | ||
| | Command line argument | ||
| | Environment variable name | ||
| | Description | ||
| | Example value | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.idp-type` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_IDP_TYPE` | ||
| | Type of the Identity Provider (IdP). Currently `ENTRA_ID`, `GOOGLE_IDENTITY` and `OKTA` are supported. | ||
| | `ENTRA_ID` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.grant-type` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_GRANT_TYPE` | ||
| | Type of the OAuth authorization grant or flow to use. Currently `IMPLICIT`, `AUTHORIZATION_CODE` and `PKCE` are supported. | ||
| | `IMPLICIT` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.display-name` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_DISPLAY_NAME` | ||
| | Display name of the login option on the NOM login page. | ||
| | `Login with Entra ID` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.admin-check` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_ADMIN_CHECK` | ||
| | SpEL expression to check if the user should be assigned the NOM ADMIN role in NOM. | ||
| See xref:_role_assignment[Role assignment] for details. | ||
| | `['groups']?.contains('aaa63d30-70c3-4181-8c19-1b58e613f55b')` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.read-only-user-check` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_READ_ONLY_USER_CHECK` | ||
| | SpEL expression to check if the user should be assigned the NOM READ_ONLY_USER role in NOM. | ||
| See xref:_role_assignment[Role assignment] for details. | ||
| | `['groups']?.contains('bbb2c5c5-a181-458a-a933-8ea7339d1310')` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.username-claim` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_USERNAME_CLAIM` | ||
| | SpEL expression to override the default field for the username in the token claims. | ||
| | `['unique_name']` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.email-claim` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_EMAIL_CLAIM` | ||
| | SpEL expression to override the default field for the email in the token claims. | ||
| | `['verified_email']` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.firstname-claim` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_FIRSTNAME_CLAIM` | ||
| | SpEL expression to override the default field for the first name in the token claims. | ||
| | `['given_name']` | ||
|
|
||
| | `app.sso.configurations.<CONFIG>.lastname-claim` | ||
| | `APP_SSO_CONFIGURATIONS_<CONFIG>_LASTNAME_CLAIM` | ||
| | SpEL expression to override the default field for the last name in the token claims. | ||
| | `['family_name']` | ||
| |=== | ||
|
|
||
| [#_role_assignment] | ||
| ==== Role assignment | ||
|
|
||
| The `admin-check` and `read-only-user-check` options are https://docs.spring.io/spring-framework/reference/core/expressions/language-ref.html[SpEL expressions] that are evaluated against the claims in the access token obtained from the IdP. | ||
|
|
||
| The claims object is available as the root object in the expression context. | ||
|
|
||
| The expressions should evaluate to `true` or `false`. | ||
| If the `admin-check` expression evaluates to `true`, the user is assigned the xref:../nom-user-management/index.adoc#_roles_of_nom_users[NOM Admin role]. | ||
| Otherwise, the read-only-user-check expression is evaluated. | ||
| If it evaluates to `true`, the user is assigned the xref:../nom-user-management/index.adoc#_roles_of_nom_users[read-only Administrator] role. | ||
| If both expressions evaluate to `false`, the user is denied access to NOM. | ||
|
|
||
| *Examples of expressions* | ||
|
|
||
| |=== | ||
| | Goal |Expression | ||
|
|
||
| |Check that a list contains _all_ required values | ||
| |`['groups']?.containsAll({'nom_group1', 'nom_group2'})` | ||
|
|
||
| |Check that a list contains _at least one_ of the required values (with a logical expression) | ||
| |`['groups']?.contains('nom_group1') or ['groups']?.contains('nom_group2')` | ||
|
|
||
| |Check that a list contains _at least one_ of the required values (with a SpEL predicate expression) | ||
| |`['groups'].?[ {'nom_group1', 'nom_group2'}.contains(#this) ].size() > 0` | ||
|
|
||
| |=== | ||
|
|
||
|
|
||
| To debug issues with role assignment, see the xref:_troubleshooting[Troubleshooting section] below. | ||
|
|
||
| ==== Overriding claim fields | ||
|
|
||
| By default, IdP specific fields in the token claims are used to create or update the SSO user fields in NOM. | ||
| It is possible to override the default fields by providing SpEL expressions using the options `username-claim`, `email-claim`, `firstname-claim` and `lastname-claim`. | ||
|
|
||
| The expressions should evaluate to a string value and are evaluated against the claims object in the access token. | ||
| If an expression evaluates to `null` or if there are errors during evaluation, the corresponding user field is set according to the default behavior. | ||
|
|
||
| For example, to use the JWT claim `verified_email` as user email address, use the config option `app.sso.configurations.<CONFIG>.email-claim=['verified_email']`. | ||
| This expression evaluates to the value of the key `verified_email` in the JWT claims `Map`. | ||
|
|
||
| Debugging issues with claim field extraction can be done as described in the xref:_troubleshooting[Troubleshooting section] below. | ||
|
|
||
| [#_troubleshooting] | ||
| == Troubleshooting | ||
|
|
||
| === General tips | ||
|
|
||
| * Test in a private/incognito browser window to avoid issues with cached tokens or cookies. | ||
| * Check the NOM server logs for errors during startup or user login (lines containing "SecurityLogger"). | ||
| * Verify that the callback URL configured in the IdP matches the one used in NOM server. | ||
| * Ensure that the system time on the NOM server host is synchronized with a time server, as time discrepancies can cause token validation to fail. | ||
| * Ensure that the NOM server can reach the IdP endpoints (authority, token, userinfo) over the network. | ||
|
|
||
| === Start with a simple configuration | ||
|
|
||
| Set `admin-check` and `read-only-user-check` to `true` to verify that SSO authentication works in principle. | ||
| If this does not work, check the configuration options for typos and verify that the callback URL configured in the IdP matches the one used in NOM server. | ||
|
|
||
| === Debugging role assignment and custom claim issues | ||
|
|
||
| Enable debug logging by setting the NOM server config option `xref:../installation/server.adoc#config_ref[logging.level.com.neo4j.opsmanager.server.config]` to `debug`. | ||
| With this setting, the evaluated role assignment expressions and the claims object are logged during user login, starting with a log line containing `SsoConfig tracing expression`. | ||
| Example: | ||
|
|
||
| [source,log] | ||
| ---- | ||
| 2025-10-16T12:26:45.602+02:00 DEBUG 191053 --- [or-http-epoll-4] c.n.opsmanager.server.config.SsoConfigs : | ||
| SsoConfig tracing expression ['groups']?.contains('xb5c63d30-70c3-4181-8c19-1b58e613f55b') && ['groups']?.contains('aaa63d30-a181-458a-a933-8ea7339d1310') | ||
| on the claims object | ||
| { | ||
| sub=..., | ||
| ... | ||
| groups=[aaa63d30-a181-458a-a933-8ea7339d1310, ..., ...], | ||
| ... | ||
| } | ||
| 2025-10-16T12:26:45.607+02:00 DEBUG 191053 --- [or-http-epoll-4] c.n.opsmanager.server.config.SsoConfigs : | ||
| Method call: [aaa63d30-a181-458a-a933-8ea7339d1310, ..., ...]}.contains}([aaa63d30-a181-458a-a933-8ea7339d1310]}) -> true} | ||
| ... | ||
| ---- | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.