SAML2 Authentication

CAS can act as a SAML2 identity provider accepting authentication requests and producing SAML assertions.

If you intend to allow CAS to delegate authentication to an external SAML2 identity provider, you need to review this guide.

:information_source: SAML Specification

This document solely focuses on what one might do to turn on SAML2 support inside CAS. It is not to describe/explain the numerous characteristics of the SAML2 protocol itself. If you are unsure about the concepts referred to on this page, please start with reviewing the SAML2 Specification.

Federation Interop Evaluation

The CAS project strives to conform to the SAML V2.0 Implementation Profile for Federation Interoperability. An evaluation of the requirements against the current CAS release is available here. It is recommended that you view, evaluate and comment on functionality that is currently either absent or marked questionable where verification is needed.

SAML Endpoints

The following CAS endpoints respond to supported SAML2 profiles:

  • /idp/error
  • /idp/profile/SAML2/Redirect/SSO
  • /idp/profile/SAML2/POST/SSO
  • /idp/profile/SAML2/POST-SimpleSign/SSO
  • /idp/profile/SAML2/POST/SLO
  • /idp/profile/SAML2/Redirect/SLO
  • /idp/profile/SAML2/Unsolicited/SSO
  • /idp/profile/SAML2/SOAP/ECP
  • /idp/profile/SAML2/SOAP/AttributeQuery
  • /idp/profile/SAML1/SOAP/ArtifactResolution

Metadata Management

Handling and storing SAML2 identity provider or service provider metadata can be done in a few ways. To learn more, please review this guide.


Support is enabled by including the following dependency in the WAR overlay:

implementation "org.apereo.cas:cas-server-support-saml-idp:${project.'cas.version'}"
dependencyManagement {
    imports {
        mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"

dependencies {
    implementation "org.apereo.cas:cas-server-support-saml-idp"
dependencies {
    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-saml-idp"

You may also need to declare the following repository in your CAS overlay to be able to resolve dependencies:

repositories {
    maven { 
        mavenContent { releasesOnly() }
        url "" 

The following settings and properties are available from the CAS configuration catalog:

The configuration settings listed below are tagged as Required in the CAS configuration metadata. This flag indicates that the presence of the setting may be needed to activate or affect the behavior of the CAS feature and generally should be reviewed, possibly owned and adjusted. If the setting is assigned a default value, you do not need to strictly put the setting in your copy of the configuration, but should review it nonetheless to make sure it matches your deployment expectations.

  • cas.authn.saml-idp.core.session-replication.cookie.crypto.encryption.key=
  • The encryption key is a JWT whose length is defined by the encryption key size setting.


  • cas.authn.saml-idp.core.session-replication.cookie.crypto.signing.key=
  • The signing key is a JWT whose length is defined by the signing key size setting.


  • cas.authn.saml-idp.core.entity-id=
  • The SAML entity id for the deployment.

    This setting supports the Spring Expression Language.

    The configuration settings listed below are tagged as Optional in the CAS configuration metadata. This flag indicates that the presence of the setting is not immediately necessary in the end-user CAS configuration, because a default value is assigned or the activation of the feature is not conditionally controlled by the setting value. In other words, you should only include this field in your configuration if you need to modify the default value or if you need to turn on the feature controlled by the setting.

  • cas.authn.saml-idp.core.session-replication.replicate-sessions=true
  • Indicates whether profiles and other session data, collected as part of authentication flows and protocol requests that are kept by the container session, should be replicated across the cluster using CAS and its own ticket registry. Without this option, profile data and other related pieces of information should be manually replicated via means and libraries outside of CAS.

  • cas.authn.saml-idp.core.session-replication.cookie.crypto.alg=
  • The signing/encryption algorithm to use.


  • cas.authn.saml-idp.core.session-replication.cookie.crypto.enabled=true
  • Whether crypto operations are enabled.


  • cas.authn.saml-idp.core.session-replication.cookie.crypto.encryption.key-size=512
  • The encryption key size.


  • cas.authn.saml-idp.core.session-replication.cookie.crypto.signing.key-size=512
  • The signing key size.


  • cas.authn.saml-idp.core.session-replication.cookie.crypto.strategy-type=ENCRYPT_AND_SIGN
  • Control the cipher sequence of operations. The accepted values are:

    • ENCRYPT_AND_SIGN: Encrypt the value first, and then sign.
    • SIGN_AND_ENCRYPT: Sign the value first, and then encrypt.


  • cas.authn.saml-idp.core.session-replication.cookie.allowed-ip-addresses-pattern=
  • A regular expression pattern that indicates the set of allowed IP addresses, when #isPinToSession() is cofigured. In the event that there is a mismatch between the cookie IP address and the current request-provided IP address (i.e. network switches, VPN, etc), the cookie can still be considered valid if the new IP address matches the pattern specified here.

    This settings supports regular expression patterns. [?].

  • Decide if cookie paths should be automatically configured based on the application context path, when the cookie path is not configured.

  • cas.authn.saml-idp.core.session-replication.cookie.domain=
  • Cookie domain. Specifies the domain within which this cookie should be presented. The form of the domain name is specified by RFC 2965. A domain name begins with a dot ( and means that the cookie is visible to servers in a specified Domain Name System (DNS) zone (for example,, but not By default, cookies are only returned to the server that sent them.

  • cas.authn.saml-idp.core.session-replication.cookie.http-only=true
  • true if this cookie contains the HttpOnly attribute. This means that the cookie should not be accessible to scripting engines, like javascript.

  • cas.authn.saml-idp.core.session-replication.cookie.max-age=-1
  • The maximum age of the cookie, specified in seconds. By default, -1 indicating the cookie will persist until browser shutdown. A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age. A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.

  • Cookie name. Constructs a cookie with a specified name and value. The name must conform to RFC 2965. That means it can contain only ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a $ character. The cookie's name cannot be changed after creation. By default, cookies are created according to the RFC 2965 cookie specification. Cookie names are automatically calculated assigned by CAS at runtime, and there is usually no need to customize the name or assign it a different value unless a special use case warrants the change.

  • cas.authn.saml-idp.core.session-replication.cookie.path=
  • Cookie path. Specifies a path for the cookie to which the client should return the cookie. The cookie is visible to all the pages in the directory you specify, and all the pages in that directory's subdirectories. A cookie's path must include the servlet that set the cookie, for example, /catalog, which makes the cookie visible to all directories on the server under /catalog. Consult RFC 2965 (available on the Internet) for more information on setting path names for cookies.

  • When generating cookie values, determine whether the value should be compounded and signed with the properties of the current session, such as IP address, user-agent, etc.

  • cas.authn.saml-idp.core.session-replication.cookie.same-site-policy=
  • If a cookie is only intended to be accessed in a first party context, the developer has the option to apply one of settings SameSite=Lax or SameSite=Strict or SameSite=None to prevent external access.

    To safeguard more websites and their users, the new secure-by-default model assumes all cookies should be protected from external access unless otherwise specified. Developers must use a new cookie setting, SameSite=None, to designate cookies for cross-site access. When the SameSite=None attribute is present, an additional Secure attribute is used so cross-site cookies can only be accessed over HTTPS connections.

    Accepted values are:
    • Lax
    • Strict
    • None
    • Off: Disable the generation of the SameSite cookie attribute altogether.
    • Path to a Groovy script that is able to generate the SameSite cookie attribute dynamically.
    • Fully qualified name of a class that implements org.apereo.cas.web.cookie.CookieSameSitePolicy

  • True if sending this cookie should be restricted to a secure protocol, or false if the it can be sent using any protocol.

  • cas.authn.saml-idp.core.attribute-friendly-names=
  • A mapping of attribute names to their friendly names, defined globally. Example might be urn:oid:>eduPersonPrincipalName.

  • cas.authn.saml-idp.core.attribute-query-profile-enabled=false
  • Indicates whether attribute query profile is enabled. Enabling this setting would allow CAS to record SAML responses and have them be made available later for attribute lookups.

  • cas.authn.saml-idp.core.authentication-context-class-mappings=
  • A mapping of authentication context class refs. This is where specific authentication context classes are reference and mapped to providers that CAS may support mainly for, i.e. MFA purposes.

    Example might be urn:oasis:names:tc:SAML:2.0:ac:classes:SomeClassName->mfa-duo.

    In delegated authentication scenarios, this can also be a mapping of authentication context class refs, when CAS is proxying/delegating authentication to an external SAML2 identity provider. The requested authentication context as submitted by the service provider is first received by CAS, and then gets mapped to a context class that is passed onto the external identity provider. For example, you might have a scenario where a SAML2 service provider would submit to CAS, and CAS would translate that to to ultimate route the authentication request to Azure. If no mapping is found, the original context is passed as is.

    Example might be>

  • cas.authn.saml-idp.core.session-storage-type=
  • Indicates whether saml requests, and other session data, collected as part of SAML flows and requests that are kept by the container http session, local storage, or should be replicated across the cluster. Available values are as follows:

    • HTTP: Authentication requests, and other session data collected as part of authentication protocol flows and requests are kept in the http servlet session that is local to the server.
    • BROWSER_SESSION_STORAGE: Authentication requests, and other session data collected as part of authentication protocol flows and requests are kept in the client browser's session storage, signed and encrypted. All interactions require client-side read/write operations to restore the session from the browser.
    • TICKET_REGISTRY: Authentication requests, and other session data collected as part of authentication protocol flows and requests are tracked as CAS tickets in the registry and replicated across the entire cluster as tickets. This state is tied to the user's agent/browser using a special cookie that would be used to locate and restore that state. The cookie content may be signed and encrypted.