OpenID Connect (OAuth2) #5376270/HEAD / v341 |
Tags:
not added yet
Table of Contents
Single Sign-On via OpenID Connect (OAuth2)Starting with release 9.3, codebeamer also supports Single Sign-On via MITREid Connect, a certified OpenID Connect reference implementation in Java on the Spring platform by the MIT Internet Trust Consortium.
The option is available since codebeamer 10.0
Enable OpenID by environment variable (default = true) CB_openId_enabled=true Automatic OpenID login is configurable.
Environment variable CB_openId_automatic=true Application JSON: "openId" : { "automatic" : true } Interactive authentication at Web GUIWhen interactively accessing the codebeamer Web GUI via a Web Browser (User Agent), codebeamer will act as the Client Application and also as the Resource Server in the OpenID Connect Authorization Code Flow:
User account matching is done via the first non-empty value of the following user infovalues profile claims:
Any whitespace in the resulting codebeamer user account name will be removed.
The option is available since codebeamer 10.0
User account matching is configurable in the following way.
Environment variable CB_openId_client_resolveUserBy="email, username" Application JSON "openId" : { "client" : { "resolveUserBy" : "email, username" } } Available options: email, ssoId, username Default values: ssoId, username, email
User account matching is done via the first non-empty value of the configured user infovalues profile claims. An interactive user logout at codebeamer will
If the Authorization Server offers front-channel logout, logging out at the Authorization Server will also indirectly log out that user from codebeamer.
Example 1: Sign In with GoogleWhen using the Google Authorization Server, standard Google Web Single Sign-On will be applied, where you first have to enter you username/email and then your password: Example 2: Sign In with MITREid ConnectWhen using the MITREid Connect Authorization Server, the screens are completely different:
Upon logout from codebeamer, the user will be redirected to the OpenID Connect Server's logout page:
REST-API authentication via OAuth2If a 3-rd party Client Application wants to access an OpenID Connect protected codebeamer instance (e.g. via the Legacy REST API (v1)), then codebeamer only acts as the Resource Server, and the Client Application is responsible for obtaining an OAuth2 access token from the appropriate Authorization Server and passing it on to codebeamer with each request: OpenID ProviderYou can choose public OpenID Providers, e.g. or you can setup your own (certified) corporate OpenID Connect provider, e.g.
One codebeamer instance can only have a single OpenID Provider.
OpenID Client RegistrationThe Client registration process depends on the chosen OpenID Provider, but typically you will always have to provide:
After successful registration, the Client must also have:
OpenID Connect ConfigurationThe configuration for OpenID Connect is stored in System Admin → Application Configuration in the section openId.
See also Docker compose for testing OpenID setup, how to configure a Docker container with OpenID Connect. In CB-9.3, you could only configure one OAuth/OpenID Connect server and client: "openId" : { "client" : { "clientId" : "26576725-kdf73jgfgu7653flfhe7t53.apps.googleusercontent.com", "clientName" : "Your codebeamer Instance", "clientSecret" : "lkfjdu736ei7hJF#3", "tokenEndpointAuthMethod" : "SECRET_BASIC", "scope" : "openid, profile, email", "redirectUris" : "http://intservers.no-ip.biz:58800/cb/login.spr", "userName": "preferred_username", "reuseDefaultAccount" : true }, "server" : { "issuer" : "https://accounts.google.com", "authorizationEndpointUri" : "https://accounts.google.com/o/oauth2/v2/auth", "tokenEndpointUri" : "https://oauth2.googleapis.com/token", "jwksUri" : "https://www.googleapis.com/oauth2/v3/certs", "userInfoUri" : "https://openidconnect.googleapis.com/v1/userinfo", "introspectionEndpointUri" : "https://www.googleapis.com/oauth2/v3/tokeninfo", "revocationEndpointUri" : "https://oauth2.googleapis.com/revoke", "endSessionEndpoint" : "https://accounts.google.com/logout" } }
In CB-9.4 and newer, an OAuth/OpenID Connect provider can have it's own
and different client configurations for
E.g.: "openId" : { "server" : { "issuer" : "http://my.oidc.provider" }, "authentication" : { "clientId" : "cbAuth", "clientName" : "cbAuth@test-pc", "clientSecret" : "AIJ0OWXu ...", "tokenEndpointAuthMethod" : "client_secret_basic", "scope" : "openid, profile, email, phone, address, offline_access", "userName": "preferred_username" }, "introspection" : { "clientId" : "cbIntro", "clientName" : "cbIntro@test-pc", "clientSecret" : "wEDO8i3Q ...", "tokenEndpointAuthMethod" : "client_secret_basic" }, "reuseDefaultAccount" : true, "forceOAuth" : false, "cacheSuccessTTL" : "10min", "cacheFailureTTL" : "15min", "validatorCacheTTL" : "60min", "symmetricKeyValidatorCacheTTL" : "24hours", "audienceWhitelist" : "a,b" }
If an OAuth/OpenID Connect provider does not require different clients for OpenID Connect authentication and OAuth2 access token introspection, then you do not need an extra introspection configuration: Introspection will be done with the authentication configuration.
In that case you can also use client as an alias for authentication.
In CB-9.5 and newer, you can also configure the mapping of OpenID Connect provider specific user information to the codebeamer user account attributes, e.g. "openId" : { "server" : { ... }, "client" : { ... }, "user" : { "name" : "preferred_username", "firstName" : "given_name", "lastName" : "family_name", "email" : "email", "phone" : "phone_number", "mobile" : "mobile_number", "language" : "locale", "timeZonePattern" : "zoneinfo" }, ... }
"server" : { "issuer" : "https://accounts.google.com" }
Otherwise you have to provide information for all the necessary server end-points manually, e.g.: "server" : { "issuer" : "https://accounts.google.com", "authorizationEndpointUri" : "https://accounts.google.com/o/oauth2/v2/auth", "tokenEndpointUri" : "https://oauth2.googleapis.com/token", "jwksUri" : "https://www.googleapis.com/oauth2/v3/certs", "userInfoUri" : "https://openidconnect.googleapis.com/v1/userinfo", "introspectionEndpointUri" : "https://www.googleapis.com/oauth2/v3/tokeninfo", "revocationEndpointUri" : "https://oauth2.googleapis.com/revoke", "endSessionEndpoint" : "https://accounts.google.com/logout" }
Please note: Although Google supports server configuration discovery, the returned server configuration does not contain the "endSessionEndpoint". Therefore a static configuration is necessary.
If an OAuth/OpenID Connect provider does not require different client configurations for authentication and introspection, then you do not need an extra introspection configuration: Introspection will be done with the authentication (or client) configuration:
The set of claims about the End-User, that will be returned from the User Info Endpoint of an OpenID Connect provider, is defined via the client/authentication configuration (see above):
Using the claims parameter is the only way to request Claims outside the standard set. It is also the only way to request specific combinations of the standard Claims, that cannot be specified using scope values.
Please consult the /.well-known/openid-configuration of your provider, which it actually supports.
The optional user section (CB-9.5 and newer) is only required, if the OpenID ConnectProvider does not return the standard OpenID Connect userinfo claims (e.g. Microsoft ADFS) or you need to map additional claims.
In CB-9.4 and older, or if you do not specify a provider specific userclaims to codebeamer account attributes mapping, the following default/standard mapping will be applied: "user" : { "name" : "sub", "title" : null, "firstName" : "given_name", "lastName" : "family_name", "company" : null, "industry" : null, "address" : "address.street_address", "zip" : "address.postal_code", "city" : "address.locality", "state" : "address.region", "country" : "address.country", "language" : "locale", "timeZonePattern" : "zoneinfo", "email" : "email", "phone" : "phone_number", "mobile" : null, "skills" : "profile", "sourceOfInterest": null, "divisionSize" : null, "teamSize" : null }
Even if you do not specify a full custom user mapping, you can still override the default username := "sub" mapping via the userName setting in the client/authentication configuration, e.g. "userName" : "preferred_username".
The left (target) side of the user info mapping is the codebeamer account (UserDto) attribute name and these names are fixed. But you only have to specify those attributes, that you actually want to map. At least name and email are required, all others are optional.
The right (value) side of the user info mapping is a comma-separated list of the claims, to map to this codebeamer user attribute. If you specify multiple claims, the attribute value will be the value of the first claim, that is actually present, e.g. "user" : { "name" : "preferred_username, name", ... }
will only assign the value of the name claim to the codebeamer user name, if there is no preferred_username claim. Precedence is from left to right.
To map aggregated claims, e.g. address, use the dot operator, e.g. "user" : { ... "address" : "address.street_address", "zip" : "address.postal_code", "city" : "address.locality", "state" : "address.region", "country" : "address.country", ... }
A value of null for a user attribute, explicitly marks this attribute as do not map. Simply omitting the attribute has the same effect.
The attribute names divisionSize and "teamSize" are a little bit misleading, because they are not numbers but strings. So you can actually assign department name/ids or organizational unit names/ids to these fields, e.g. "user" : { ... "divisionSize" : "department_number", "teamSize" : "http://example.info/claims/groups", ... }
Please note, that codebeamer user accounts do not have attributes for nickname, middle_name, gender and birthdate. The mapping of the picture is currently also not supported.
Please note, that the Microsoft Active Directory Federation Services (ADFS) do not return the standard OpenID Connect userinfo claims by default!
Instead you get something like: { "iss": "https://my-adfs.cloudapp.azure.com/adfs", "aud": "https://my-codebeamer.host", "sub": "248289761001", "upn": "Jane.Doe@example.com", "unique_name": "Jane.Doe", "sid": "S-1-5-21-72543-3645445-326572-242", ... }
The actual response depends on the ADFS configuration, and will typically include more claims than shown above.
We suggest, to reconfigure ADFS to return standard OpenID Connect claims, but if that is not possible, you need a custom ADFS claims to codebeamer user mapping (only CB-9.5 and newer). E.g. "openId" : { "server" : { "issuer" : "https://my-adfs.cloudapp.azure.com/adfs" }, "client" : { ... }, "user" : { "name" : "unique_name", "email" : "upn", ... }, ... }
In CB-9.4 and newer there are also direct openID settings:
Since 21.04-SP1 white list for audience can be set
Since 21.04-SP2 expiration time for certificates can be set
Since CB-10.0 redirectUri must be set "openId" : { "authentication" : { ... "redirectUri" : https://<domain>/(cb)/login/oauth/authenticate.spr ... } } OpenID Configuration Using PingFederateYou can create a Codebeamer PingFederate OAuth client to verify the authenticity of the access tokens received by the Codebeamer server.
For a given Codebeamer server, you must first enable OpenID on the PingFederate server.
On the PingFed server under OAuth Settings ► Authorization Server Settings, ensure that the following check boxes are selected:
To create this OAuth client, complete the following steps:
For example, if the Codebeamer Client id is CB_Client, the openId will appear as: "openId" : { "allowSignUp" : true, "audienceWhitelist" : "", "cacheFailureTTL" : "15min", "cacheSuccessTTL" : "10min", "enabled" : true, "forceOAuth" : false, "reuseDefaultAccount" : false, "server" : { "authorizationEndpointUri" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031/as/authorization.oauth2", "introspectionEndpointUri" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031/as/introspect.oauth2", "issuer" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031", "jwksUri" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031/pf/JWKS", "registrationEndpointUri" : "", "requestTokenUri" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031/idp/SSO.saml2", "revocationEndpointUri" : "", "tokenEndpointUri" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031/as/token.oauth2", "userInfoUri" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031/idp/userinfo.openid" }, "client" : { "authType" : "ACCESSTOKEN", "clientId" : "CB_Client", "clientName" : "CB_Client", "clientSecret" : "cbTest", "domain" : "", "introspectUserResolveAttribute" : "ssoid", "redirectUri" : "https://ppuwsv-alm15t.ptcnet.ptc.com:9152/login/oauth/authenticate.spr", "refreshTokenScope" : "WINDCHILL_READ", "scope" : "openid, profile, email, WINDCHILL_READ", "tokenEndpointAuthMethod" : "client_secret_basic", "userName" : "sub", "userResolveResource" : "INTROSPECTION" }
DPT-Specific KeysThe following keys are DPT-specific and are required when using OAuth configuration for DPT:
Also, the oAuthConfigId specified in the OSLC configuration, must match the issuer key value specified here under openId OAuth configuration.
For instance: "oslc" : { "enabled" : true, "oAuthConfigId" : "https://pwdcsv-wcqa18d.ptcnet.ptc.com:9031", . . . }
Multiple OAuth2/OpenId Connect providersIn CB-9.4 and newer, you can configure multiple OAuth/OpenID Connect providers, each provider having it's own
and different client configurations for
E.g.: "openId" : { "issuers" : [{ "server" : { "issuer" : "http://my.oidc.provider" }, "authentication" : { "clientId" : "cbAuth", "clientName" : "cbAuth@test-pc", "clientSecret" : "AIJ0OWXu ...", "tokenEndpointAuthMethod" : "client_secret_basic", "scope" : "openid, profile, email, phone, address, offline_access", "userName": "preferred_username" }, "introspection" : { "clientId" : "cbIntro", "clientName" : "cbIntro@test-pc", "clientSecret" : "wEDO8i3Q ...", "tokenEndpointAuthMethod" : "client_secret_basic" } }, { "server" : { "issuer" : "https://accounts.google.com", "authorizationEndpointUri" : "https://accounts.google.com/o/oauth2/v2/auth", "tokenEndpointUri" : "https://oauth2.googleapis.com/token", "jwksUri" : "https://www.googleapis.com/oauth2/v3/certs", "userInfoUri" : "https://openidconnect.googleapis.com/v1/userinfo", "introspectionEndpointUri" : "https://www.googleapis.com/oauth2/v3/tokeninfo", "revocationEndpointUri" : "https://oauth2.googleapis.com/revoke", "endSessionEndpoint" : "https://accounts.google.com/logout" }, "client" : { "clientId" : "26576725-kdf73jgfgu7653flfhe7t53.apps.googleusercontent.com", "clientName" : "Your codebeamer Instance", "clientSecret" : "lkfjdu736ei7hJF#3", "tokenEndpointAuthMethod" : "client_secret_basic", "scope" : "openid, profile, email", "userName": "preferred_username" } }], "issuerDiscovery" : "webFinger", ... }
But the default issuer discovery
If that is not sufficient, you have to specify the alternative method of issuer discovery:
The bean or class must either
Machine-to-Machine (M2M) Authentication
M2M tokens cannot always be used for the retrieval of user information from the OpenID servers.
Prerequisites
Applying the "username" configuration, the API call uses the relevant user for the authorization. The user must have an API access.
With the usage of the "usernameAttribute" configuration, codebeamer collects the username from the token according to the defined attribute name. In case of array type claims, codebeamer uses the first element.
Flow of the API callsWithout M2M configuration
M2M configuration with username
M2M configuration with usernameAttribute
ResumeeWith OAuth2/OpenId Connect authentication in affect:
|
Fast Links
codebeamer Overview codebeamer Knowledge Base Services by Intland Software |
This website stores cookies on your computer. These cookies are used to improve your browsing experience, constantly optimize the functionality and content of our website, furthermore helps us to understand your interests and provide more personalized services to you, both on this website and through other media. With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click accept to consent to our and our partners’ processing as described above. Please be aware that some processing of your personal data may not require your consent, but you have a right to object to such processing. By using our website, you acknowledge this notice of our cookie practices. By accepting and continuing to browse this site, you agree to this use. For more information about the cookies we use, please visit our Privacy Policy.Your preferences will apply to this website only.