WORKERS AHEAD!
You are viewing the development documentation for the Apereo CAS server. The functionality presented here is not officially released yet. This is a work in progress and will be continually updated as development moves forward. You are most encouraged to test the changes presented.
Clients - OpenID Connect Authentication
Clients can be registered with CAS in the following ways.
Note that OpenID connect clients as service definitions are an extension of OAuth services in CAS. All settings that apply to an OAuth service definition should equally apply here as well.
Static Registration
OpenID Connect clients can be statically registered with CAS as such:
1
2
3
4
5
6
7
8
{
"@class" : "org.apereo.cas.services.OidcRegisteredService",
"clientId": "client",
"clientSecret": "secret",
"serviceId" : "^<https://the-redirect-uri>",
"name": "OIDC",
"id": 1000
}
Client application redirect URIs are specified
using the serviceId
field which supports regular expression patterns. If you need to support multiple URIs, you can
try to OR them together or you may be able to construct the pattern that supports and matches all URIs with minor changes.
The following fields are specifically available for OpenID connect services:
Version | Reference |
---|---|
clientId |
Required. The identifier for this client application. |
clientSecret |
Required. The secret for this client application. The client secret received from the service will be URL decoded before being compared to the secret in the CAS service definition. |
clientSecretExpiration |
Optional. Time, measured in UTC epoch, at which the client_secret will expire or 0 if it will not expire. |
serviceId |
Required. The authorized redirect URI for this OIDC client. |
supportedGrantTypes |
Optional. Collection of supported grant types for this service. |
supportedResponseTypes |
Optional. Collection of supported response types for this service. |
signIdToken |
Optional. Whether ID tokens should be signed. Default is true . |
jwks |
Optional. Resource path to the keystore location that holds the keys for this application. |
jwksKeyId |
Optional. JSON web key id to find in the keystore. |
jwksCacheDuration |
Optional. The expiration policy duration, i.e. PT1S , applied to loaded/cached keys for this application. |
encryptIdToken |
Optional. Whether ID tokens should be encrypted. Default is false . |
idTokenEncryptionOptional |
Optional. Whether ID tokens encryption should be skipped if no keystore or encryption key is available. Default is false . |
includeIdTokenClaims |
Optional. Whether ID token claims should forcefully be included regardless of requested/allowed response or grant type. Default is false . |
idTokenIssuer |
Optional. Override the iss claim in the ID Token, which should only be used in special circumstances. Do NOT use this setting carelessly as the ID token’s issuer MUST ALWAYS match the identity provider’s issuer. |
idTokenSigningAlg |
Optional. The algorithm header value used to sign the id token. |
idTokenEncryptionAlg |
Optional. The algorithm header value used to encrypt the id token. |
idTokenEncryptionEncoding |
Optional. The algorithm method header value used to encrypt the id token. |
userInfoSigningAlg |
Optional. The algorithm header value used to sign user profile responses. |
userInfoEncryptedResponseAlg |
Optional. The algorithm header value used to encrypt user profile responses. |
userInfoEncryptedResponseEncoding |
Optional. The algorithm method header value used to encrypt the user profile response. |
tokenEndpointAuthenticationMethod |
Optional. The requested client authentication method to the token endpoint. |
applicationType |
Optional. web , native , or blank. Defined the kind of the application. The default, if omitted, is web . |
subjectType |
Optional value chosen from public or pairwise . Type to use when generating principal identifiers. Default is public . |
sectorIdentifierUri |
Optional. Host value of this URL is used as the sector identifier for the pairwise identifier calculation. If left undefined, the host value of the serviceId will be used instead. |
You are encouraged to only keep and maintain properties and settings needed for a particular integration. It is UNNECESSARY to grab a copy of all service fields and try to configure them yet again based on their default. While you may wish to keep a copy as a reference, this strategy would ultimately lead to poor upgrades increasing chances of breaking changes and a messy deployment at that.
Service definitions are typically managed and registered with CAS by the service management facility.
The following settings and properties are available from the CAS configuration catalog:
cas.authn.oidc.services.defaults=
Control the default, initial values for fields that are part of a OIDC service definition. This is defined as a map where the key is the field name (i.e.
|
Configuration Metadata
The collection of configuration properties listed in this section are automatically generated from the CAS source and components that contain the actual field definitions, types, descriptions, modules, etc. This metadata may not always be 100% accurate, or could be lacking details and sufficient explanations.
Be Selective
This section is meant as a guide only. Do NOT copy/paste the entire collection of settings into your CAS configuration; rather pick only the properties that you need. Do NOT enable settings unless you are certain of their purpose and do NOT copy settings into your configuration only to keep them as reference. All these ideas lead to upgrade headaches, maintenance nightmares and premature aging.
YAGNI
Note that for nearly ALL use cases, declaring and configuring properties listed here is sufficient. You should NOT have to explicitly massage a CAS XML/Java/etc configuration file to design an authentication handler, create attribute release policies, etc. CAS at runtime will auto-configure all required changes for you. If you are unsure about the meaning of a given CAS setting, do NOT turn it on without hesitation. Review the codebase or better yet, ask questions to clarify the intended behavior.
Naming Convention
Property names can be specified in very relaxed terms. For instance cas.someProperty
, cas.some-property
, cas.some_property
are all valid names. While all
forms are accepted by CAS, there are certain components (in CAS and other frameworks used) whose activation at runtime is conditional on a property value, where
this property is required to have been specified in CAS configuration using kebab case. This is both true for properties that are owned by CAS as well as those
that might be presented to the system via an external library or framework such as Spring Boot, etc.
When possible, properties should be stored in lower-case kebab format, such as cas.property-name=value
.
The only possible exception to this rule is when naming actuator endpoints; The name of the
actuator endpoints (i.e. ssoSessions
) MUST remain in camelCase mode.
Settings and properties that are controlled by the CAS platform directly always begin with the prefix cas
. All other settings are controlled and provided
to CAS via other underlying frameworks and may have their own schemas and syntax. BE CAREFUL with
the distinction. Unrecognized properties are rejected by CAS and/or frameworks upon which CAS depends. This means if you somehow misspell a property definition
or fail to adhere to the dot-notation syntax and such, your setting is entirely refused by CAS and likely the feature it controls will never be activated in the
way you intend.
Validation
Configuration properties are automatically validated on CAS startup to report issues with configuration binding, specially if defined CAS settings cannot be recognized or validated by the configuration schema. Additional validation processes are also handled via Configuration Metadata and property migrations applied automatically on startup by Spring Boot and family.
Indexed Settings
CAS settings able to accept multiple values are typically documented with an index, such as cas.some.setting[0]=value
. The index [0]
is meant to be
incremented by the adopter to allow for distinct multiple configuration blocks.
Example
An example registration record for an OpenID Connect relying party follows that allows the application with the redirect URI https://app.example.org/oidc
to send authorization requests to CAS using the authorization code authentication flow. The registration record also instructs CAS to bypass the
approval/consent screen and to assume access to requested scopes and claims should be granted automatically without the user’s explicit permission.
1
2
3
4
5
6
7
8
9
10
11
12
{
"@class": "org.apereo.cas.services.OidcRegisteredService",
"clientId": "client-id",
"clientSecret": "secret",
"serviceId": "^https://app.example.org/oidc",
"name": "MyApplication",
"id": 1,
"bypassApprovalPrompt": true,
"supportedResponseTypes": [ "java.util.HashSet", [ "code" ] ],
"supportedGrantTypes": [ "java.util.HashSet", [ "authorization_code" ] ],
"scopes" : [ "java.util.HashSet", [ "profile", "openid", "email" ] ]
}
Dynamic Registration
Client applications may dynamically be registered with CAS for authentication. See this guide for more info.