Setup SSO Authentication with External Identity Providers
Configuring CData Virtuality OAuth 2 Server
To configure the CData Virtuality OAuth 2 server, follow these steps.
Use a browser to login to CData Virtuality OAuth 2 Server, e.g. localhost:8080.
Create a realm
Provide a name, e.g. CDVSERVER_SSO
The name is the only detail needed for realm setup
The “Create realm” button is available via menu in left upper corner
Do always ensure that you work in that newly created realm and not in the master realm, especially after fresh login
Create a client
“Client type”: "OpenID Connect"
“Client ID”: provide a id (name), e.g. cdvserver_sso_client
Set up access settings for your client in the CData Virtuality OAuth 2 server
Go to your realm → your client → Settings
Set up Capability config
Turn on Client authentication
Set up Authentication flow. Choose following:
Standard flow
Implicit flow (note for Anja: missed in Google doc)
Direct access grant (note for Anja: missed in Google doc)
Service accounts role
Add the following Valid redirect URIs:
<CData Virtuality server URL e.g. http://localhost:8180 >/*;
Add the following Web origins:
<CData Virtuality server URL>
Set up service account roles
Go to your realm → your client → Service account roles
Assign the following roles:
realm-management view-users
- to allow import/refresh of usersrealm-management view-realm
- to allow import/refresh of roles
Configure identity provider
Initial setup
Open Identity Providers menu of your realm
Add "OpenID Connect" provider
Provide an Alias and optionally a display name
Provide the details as collected from external Identity Provider
"OpenID Connect metadata document URL" as discovery URL
“Client ID”
“Client Secret”
Save the Identity Provider configuration
After saving:
Extract/copy the URL shown as redirectUrl.
This URL must be set up as a redirectUrl on your external Identity Provider (e.g. see Configure the "Sign-in redirect URIs" in Okta application section in Okta SSO for SaaS)
Users and roles
Users and roles could be loaded to the CData Virtuality OAuth 2 server using Identity Provider extension or by using Mappers.
Mappers setup
Create a Mapper to assign the Identity Provider groups to CData Virtuality OAuth 2 server roles. The “Mapper” menu is accessible via “Identity Providers” → Identity Provider added on previous step → “Mapper” tab
“Name”: provide a name for the mapper to be created
“Sync mode override”: Force
“Mapper type”: Claim to Role
“Claim”: groups
“Claim Value”: the id or the name for the Identity Provider group. Examples:
Azure: 59def5b5-b0a5-443f-ab8d-f3de1782fd8a
Okta: CDV-Admin
“Role”: CData Virtuality OAuth 2 server role-name. To see the realm roles in assignment dialogue, please us "Filter by realms" in the interface
Configure one mapper per Identity Provider group that shall be mapped to a CData Virtuality OAuth 2 server/CData Virtuality server role.
Extensions setup
The extension allows importing and synchronizing users and roles from external Identity Providers into the CDV OAuth2 server. Currently, the extension is supported only for Okta. For details on how to configure the Okta extension, see Okta SSO for SaaS.
Configure CData Virtuality Server
Setting the Option Values
You need to set following CData Virtuality OAuth 2 server option values:
Option value | What is that | Where can I find it in CData Virtuality OAuth 2 server |
| the “.well-known” discovery url for the realm | “Realm Settings” -> “OpenID Endpoint Configuration” |
| the name of the realm | “Realm Settings” -> “Realm name” |
| the id of the client | “Clients” -> “Client details” -> “Settings” -> “Client ID” |
| the clientSecret of the client | “Clients” -> “Client details” -> “Credentials” -> “Client Secret” |
| controls whether users are imported from Virtuality Auth Management | true |
| controls whether roles are imported from Virtuality Auth Management | true (note for Anja: always true since no clients use useDvRoles) |
Example:
CALL "SYSADMIN.setDefaultOptionValue"(
"opt" => 'DV_AUTH_SERVER_URL'
, "val" => ' http://localhost:8081/realms/CDVSERVER_SSO/.well-known/openid-configuration');;
CALL "SYSADMIN.setDefaultOptionValue"(
"opt" => 'DV_AUTH_REALM'
, "val" => 'CDVSERVER_SSO');;
CALL "SYSADMIN.setDefaultOptionValue"(
"opt" => 'DV_AUTH_CLIENT_ID'
, "val" => 'cdvserver_sso_client';;
CALL "SYSADMIN.setDefaultOptionValue"(
"opt" => 'DV_AUTH_CLIENT_SECRET
', "val" => 'HCPYEWeiknqUOtwFRXWnodDPDSmmpCng');;
CALL "SYSADMIN.setDefaultOptionValue"(
"opt" => 'DV_AUTH_LOAD_USERS'
, "val" => true);;
CALL "SYSADMIN.setDefaultOptionValue"(
"opt" => 'DV_AUTH_LOAD_ROLES'
, "val" => true);;
Loading SSO Roles and Users
Connect to the СData Virtuality Server using the standard СData Virtuality authentication mechanism as admin and follow these steps:
Run the SYSADMIN.refreshSSOUserCache
procedure:
CODE
|
Roles and users will be loaded.
Loaded external Identity Provider roles and users have @SSO ending (e.g. admin-role@SSO
, user_1@SSO
, etc.), and user-role mapping can be seen in SYSADMIN.UserRoles
after SSO users and roles are loaded.
If you want to refresh explicitly in CData Virtuality Server, e.g. after manually removing a user or a role from CData Virtuality OAuth 2 server, call SYSADMIN.refreshSSOUserCache
Users
When using Mappers, users are added only after their first successful login. When using the extension, users are loaded along with their roles after executing SYSADMIN.refreshSSOUserCache
.
Note for Anja: I didn’t added mapper for users info.
Roles
Note for Anja: I didn’t add the info about roles loading. The bug you mentioned in the Google doc(roles without users are not loaded) is fixed in v25.1. So, we don’t need to add an info about it in the document in 25 space but need to add to 4(CV) space.
Set permissions
Permissions can be set in one of two ways.
Please decide for one approach and do not mix them.
By setting permissions for an object to the SSO role:
CODE
|
By mapping SSO roles to CData Virtuality roles. In this case, all the permissions from the CData Virtuality role will be granted to the SSO role:
CODE
|
Connecting to CData Virtuality Server using Web UI
After the DV_AUTH
option values are set, roles and users are loaded and permissions are set, you can connect to the CData Virtuality Server via SSO using the SSO authentication wizard.
The default parameters, such as the CData Virtuality OAuth 2 server URL, client ID, and client secret, are set in the dvserver\standalone\deployments\api.war\WEB-INF\classes\service-on-premise.properties
file.
To modify these parameters, unzip the api.war
file, change the parameters as needed, and then zip it back and redeploy api.war
.
Example of the settings:
oidc.server.client.id=dvserver_sso_client
oidc.server.config.url=http://localhost:8081/realms/CDVSERVER_SSO/.well-known/openid-configuration
oidc.server.client.secret=HCPYEWeiknqUOtwFRXWnodDPDSmmpCng
oidc.server.use_dv_roles=true
Note for Anja: I didn’t add Skip the intermediate login screen section
Connecting to CData Virtuality Server using Studio
After the DV_AUTH
option values are set, roles and users are loaded and permissions are set, you can connect to the CData Virtuality Server using the OAuth 2.0 authentication with access/refresh tokens. For details on how to obtain tokens, see Obtain Access and Refresh Tokens section.
Connecting to CData Virtuality Server using JDBC driver
After the DV_AUTH
option values are set, roles and users are loaded and permissions are set, you can connect to the CData Virtuality Server using the OAuth 2 authentication.
Set the authType=OAUTH2
parameter to use OAuth 2 authentication.
You should use access/refresh tokens to connect. For details on how to obtain tokens, see Obtain Access and Refresh Tokens section.
Connection string example:
jdbc:cdatavirtuality:datavirtuality@mms://localhost:31001;authType=OAUTH2;accessToken=<token>;refreshToken=<token>
Obtain Access and Refresh Tokens
Obtain Okta users access and refresh tokens:
Get authorization code:
URL to obtain authorization code: <CData Virtuality OAuth 2 Server URL>/realms/<your realm name>/protocol/openid-connect/auth?response_type=code&client_id=<your client id>&redirect_uri=http://localhost/;
Select Okta and login using standard Okta authorization;
Copy code from the redirected URL:
Get access and refresh tokens:
URL to get tokens: <CData Virtuality OAuth 2 Server URL>/realms/<your realm name>/protocol/openid-connect/token;
Parameters in request body:
grant_type = authorization_code
client_id = <your client id>
client_secret = <your client secret>
redirect_uri = http://localhost/
code = from Step 1
Use the returned access and refresh tokens while connecting via CData Virtuality Studio and JDBC/ODBC clients.