From version ROB-EX Scheduler v7.6 the use of OAuth identity providers is supported.
When the ROB-EX Scheduler Multiuser Server is correcly configured for OAuth login, the login form will contain additional buttons for the different configured OAuth clients, like shown on this picture.
The OAuth authorization code flow is used to authenticate the user with an external OAuth provider.
The ROB-EX Scheduler Multiuser Server is based on Spring Security meaning, a lot of the information regarding the OAuth configuration can be found in the Spring Security OAuth pages:
Main steps to configure OAuth authentication
In your OAuth provider
- setup an OAuth client with the authorization code flow enabled.
- Add redirect urls to point to the ROB-EX Scheduler client endpoint of the server installation
- eg.https://<robex_server_host_and_port>/login/oauth2/code/<client_name>
- Collect the issuer uri, client id and client credentials from the newly created OAuth client
In ROB-EX Scheduler
- Configure the ROB-EX Scheduler Multiuser Server through the application.yaml configuration file to authenticate against the OAuth client
- Setup OAuth role mapping or configure site access through Admin UI
Relevant OAuth configuration settings in application.yml
# Spring configuration changes
spring:
security:
oauth2:
resourceserver: # Configure resource server that uses the oauth token
jwt:
issuer-uri: <oauth issuer uri>
client: # Oauth client configuration section
provider: # Oauth provider configuration section
my-oauth-provider: # Name of the provider - used below to identify which provider the client registration uses
issuer-uri: <oauth issuer uri>
user-name-attribute: email # User name attribute used to map a oauth claim to the username in Rob-Ex
registration:
my-oauth-client: # Specific OAuth client registration
provider: my-oauth-provider # Link to provider above
client-name: My OAuth provider name # Name used for Login button in Rob-Ex
client-id: <oauth-client-id>
client-secret: <oauth client secret>
scope: # Scopes requested from the OAuth client
- openid # needed for OAuth
- profile # needed for OAuth
- email # needed for OAuth
- Robex_User # Optional scopes below used to map to roles in Rob-Ex
- Robex_Admin
- Robex_Planner
- Robex_Viewer
# Robex configuration changes
robex:
auth:
internal:
enabled: true # Enable "internal user authentication" - the default user authentication in Rob-Ex
oauth:
enabled: true # Enable OAuth user authentication - configure above
groupsClaim: groups # Optional claim name of groups claim used to map against external role mappings in Rob-Ex
Role mapping
A newly install of ROB-EX Scheduler Multiuser Server will have a set of default predefined external role mappings:
- Robex_Admin
- Grants the “All site admin role”
- Robex_Planner
- Grants the “All site planner role”
- Robex_Viewer
- Grants the “All site viewer role”
More mappings can be added through the Admin UI in Configure->Security rules by adding a Security rule of type AD Mapping
. As “AD Group/User” enter the Scope/Claim keyword.
To map OAuth users to roles in ROB-EX Scheduler there are two approaches:
- Scope role mapping
- Claim role mapping
Scope role mapping
In the OAuth client define which scopes should be available to ROB-EX Scheduler. That could be the predefined roles, eg. Robex_Admin, Robex_Viewer, Robex_Planner. Or any other scope you define.
When logging in with OAuth the server is set up to request all scopes for the user – if a user is only a viewer, the OAuth server will only return the Robex_Viewer scope.
After OAuth authentication the ROB-EX Scheduler Multiuser Server now checks all granted scopes from the user against external role mappings defined as Security rules.
If a scope matches an external role mapping, then the user is granted the defined role for the mapping.
Claim role mapping
When authenticating with OAuth, the OAuth server returns a set of claims, like name, email, etc. If the OAuth server is configured to return a claim with roles, the ROB-EX Scheduler Multiuser Server can extract the roles and match them against preconfigured external role mappings, like the scope mapping above.
Use the robex.auth.oauth.groupsClaim
setting to control the claim with groups. The groups claim can be nested eg. “resource_access.roles” or just a root claim like “groups” . See below how to configure it.
# Robex configuration changes
robex:
auth:
internal:
enabled: true # Enable "internal user authentication" - the default user authentication in Rob-Ex
oauth:
enabled: true # Enable OAuth user authentication - configure above
groupsClaim: groups # Optional claim name of groups claim used to map against external role mappings in Rob-Ex
Using sample configuration files
A list of pre-made examples are available in the ganttServerG2\config_examples
folder in the installation directory of ROB-EX Scheduler Multiuser Server. The easiest way to apply a setup for an OAuth provider is to use a feature of Spring Boot server, where multiple .yml configuration files are loaded on startup of the ROB-EX Scheduler Multiuser Server.
- Copy the relevant example file from
ganttServerG2\config_examples
to the parent folder. As an example copyganttServerG2\config_examples\application-azure.yml
toganttServerG2\application-azure.yml
to add support for Azure AD OAuth authentication. - Make the necessary adjustments to the
ganttServerG2\application-azure.yml
file using e.g. Notepad++ or some other editor. - Edit the primary
ganttServerG2\application.yml
file, instructing additional profiles to be active (and thus loaded) during startup of ROB-EX Scheduler Multiuser Server. This is done by editing thespring.profiles.active
setting, specifying a comma separated list of all active profiles (by default an existing sqlserver or sqlserverAD profile is typically also active!). Only specify the XXX part of the yml fileapplication-XXX.yml
. Again with Azure as the example, the resulting relevant application.yml config would read the following:
spring:
profiles:
active: sqlserver, azure
Remember to restart the ROB-EX Scheduler Multiuser Server service for any change to a .yml file to become active!
Troubleshooting
The following is a list of common problems we’ve been made aware of:
- My config seems to be correct, but the rbx_srv_log.txt file contains errors like “Caused by: io.netty.resolver.dns.DnsNameResolverException: failed to send a query ‘6762’ via UDP. Caused by: Java.net.SocketException: Network is unreachable: sendto”
- As a solution add the following startup parameter to the options part of the ROB-EX Scheduler Multiuser Server service:
-Djava.net.preferIPv4Stack=true
. Also see Server Service startup parameters.
Post your comment on this topic.