SAML2 Delegated Authentication
CAS can be configured to route the authentication requests to one or more external SAML2 identity providers. Support is enabled by including the following dependency in the WAR overlay:
1
2
3
4
5
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-pac4j-saml</artifactId>
<version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-pac4j-saml:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
imports {
mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
}
}
dependencies {
implementation "org.apereo.cas:cas-server-support-pac4j-saml"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
/*
The following platform references should be included automatically and are listed here for reference only.
implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
*/
implementation "org.apereo.cas:cas-server-support-pac4j-saml"
}
Configuration
The following settings and properties are available from the CAS configuration catalog:
cas.authn.pac4j.saml[0].keystore-password=
The password to use when generating the SP/CAS keystore.
CAS Property:
|
1 |
cas.authn.pac4j.saml[0].keystore-password=... |
cas:
authn:
pac4j:
saml[0]:
keystore-password: "..."
1
java -Dcas.authn.pac4j.saml[0].keystore-password="..." -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_KEYSTORE_PASSWORD="..."
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].keystore-password="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].keystore-path=
Location of the keystore to use and generate the SP/CAS keystore.
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].keystore-path

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.
.properties
files:
1
cas.authn.pac4j.saml[0].keystore-path=...
cas:
authn:
pac4j:
saml[0]:
keystore-path: "..."
1
java -Dcas.authn.pac4j.saml[0].keystore-path="..." -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_KEYSTORE_PATH="..."
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].keystore-path="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].private-key-password=
The password to use when generating the private key for the SP/CAS keystore.
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].private-key-password

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.
.properties
files:
1
cas.authn.pac4j.saml[0].private-key-password=...
cas:
authn:
pac4j:
saml[0]:
private-key-password: "..."
1
java -Dcas.authn.pac4j.saml[0].private-key-password="..." -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_PRIVATE_KEY_PASSWORD="..."
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].private-key-password="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].service-provider-entity-id=https://apereo.org/cas/samlsp
The entity id of the SP/CAS that is used in the SP metadata generation process.
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].service-provider-entity-id

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.
.properties
files:
1
cas.authn.pac4j.saml[0].service-provider-entity-id=https://apereo.org/cas/samlsp
cas:
authn:
pac4j:
saml[0]:
service-provider-entity-id: "https://apereo.org/cas/samlsp"
1
java -Dcas.authn.pac4j.saml[0].service-provider-entity-id="https://apereo.org/cas/samlsp" -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_SERVICE_PROVIDER_ENTITY_ID="https://apereo.org/cas/samlsp"
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].service-provider-entity-id="https://apereo.org/cas/samlsp"
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml=
Settings that deal with having SAML2 IdPs as an external delegated-to authentication provider.
CAS Property:
|
1 |
cas.authn.pac4j.saml=... |
cas:
authn:
pac4j:
saml: "..."
1
java -Dcas.authn.pac4j.saml="..." -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML="..."
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].accepted-skew=PT300S
Maximum skew in seconds between SP and IDP clocks.
This skew is added onto the NotOnOrAfter
field in seconds
for the SAML response validation.
This settings supports the
java.time.Duration
syntax [?].
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].accepted-skew

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.
.properties
files:
1
cas.authn.pac4j.saml[0].accepted-skew=PT300S
cas:
authn:
pac4j:
saml[0]:
accepted-skew: "PT300S"
1
java -Dcas.authn.pac4j.saml[0].accepted-skew="PT300S" -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_ACCEPTED_SKEW="PT300S"
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].accepted-skew="PT300S"
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].all-signature-validation-disabled=
Whether the signature validation should be disabled.
Never set this property to true
in production.
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].all-signature-validation-disabled

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.
.properties
files:
1
cas.authn.pac4j.saml[0].all-signature-validation-disabled=...
cas:
authn:
pac4j:
saml[0]:
all-signature-validation-disabled: "..."
1
java -Dcas.authn.pac4j.saml[0].all-signature-validation-disabled="..." -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_ALL_SIGNATURE_VALIDATION_DISABLED="..."
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].all-signature-validation-disabled="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].assertion-consumer-service-index=-1
Allows the SAML client to select a specific ACS url from the metadata, if defined. A negative value de-activates the selection process and is the default.
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].assertion-consumer-service-index

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.
.properties
files:
1
cas.authn.pac4j.saml[0].assertion-consumer-service-index=-1
cas:
authn:
pac4j:
saml[0]:
assertion-consumer-service-index: "-1"
1
java -Dcas.authn.pac4j.saml[0].assertion-consumer-service-index="-1" -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_ASSERTION_CONSUMER_SERVICE_INDEX="-1"
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].assertion-consumer-service-index="-1"
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.authn.pac4j.saml[0].attribute-consuming-service-index=
AttributeConsumingServiceIndex attribute of AuthnRequest element. The given index points out a specific AttributeConsumingService structure, declared into the Service Provider (SP)'s metadata, to be used to specify all the attributes that the Service Provider is asking to be released within the authentication assertion returned by the Identity Provider (IdP). This attribute won't be sent with the request unless a positive value (including 0) is defined.
org.apereo.cas.configuration.model.support.pac4j.saml.Pac4jSamlClientProperties.
CAS Property: cas.authn.pac4j.saml[].attribute-consuming-service-index

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.
.properties
files:
1
cas.authn.pac4j.saml[0].attribute-consuming-service-index=...
cas:
authn:
pac4j:
saml[0]:
attribute-consuming-service-index: "..."
1
java -Dcas.authn.pac4j.saml[0].attribute-consuming-service-index="..." -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory. Note the placement of the system property which must be
specified before the CAS web application is launched.
1
2
3
export CAS_AUTHN_PAC4J_SAML[0]_ATTRIBUTE_CONSUMING_SERVICE_INDEX="..."
java -jar build/libs/cas.war
cas.war
with an embedded server container and can be found in the build/libs
directory.
1
java -jar build/libs/cas.war --cas.authn.pac4j.saml[0].attribute-consuming-service-index="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
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.
Metadata Management
Please see this guide.
Per Service Customizations
Th configuration for the external SAML2 identity provider is typically done at build time via CAS configuration settings and applies to all applications and relying parties. You may override certain aspects this configuration on a per application basis by assigning dedicated properties to the service definition.
The following properties are available and recognized by CAS for various modules and features:
Name | Default Value | Type | Group |
---|---|---|---|
AssertionConsumerServiceIndex
|
|
LONG
|
DELEGATED_AUTHN_SAML2
|
AttributeConsumingServiceIndex
|
|
LONG
|
DELEGATED_AUTHN_SAML2
|
AuthnContextClassRefs
|
|
SET
|
DELEGATED_AUTHN_SAML2
|
AuthnRequestBindingType
|
|
STRING
|
DELEGATED_AUTHN_SAML2
|
ComparisonType
|
|
STRING
|
DELEGATED_AUTHN_SAML2
|
A sample JSON file follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"@class" : "org.apereo.cas.services.CasRegisteredService",
"serviceId" : "^https://app.example.org",
"name" : "Example",
"id" : 1,
"properties" : {
"@class" : "java.util.HashMap",
"AuthnContextClassRefs" : {
"@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty",
"values" : [ "java.util.HashSet", [ "https://refeds.org/profile/mfa" ] ]
},
"WantsAssertionsSigned" : {
"@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty",
"values" : [ "java.util.HashSet", [ "false" ] ]
}
}
}
See registered service properties for more details.
Identity Provider Discovery Service
Please see this guide.
Troubleshooting
To enable additional logging, modify the logging configuration file to add the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<Logger name="org.pac4j" level="debug" additivity="false">
<AppenderRef ref="casConsole"/>
<AppenderRef ref="casFile"/>
</Logger>
<Logger name="org.opensaml" level="debug" additivity="false">
<AppenderRef ref="casConsole"/>
<AppenderRef ref="casFile"/>
</Logger>
<Logger name="PROTOCOL_MESSAGE" level="debug" additivity="false">
<AppenderRef ref="casConsole"/>
<AppenderRef ref="casFile"/>
</Logger>