Security Configuration

There are several levels of configuration that control the security configuration of objects that are signed, encrypted, etc. These configurations include things like the keys to use, preferred/default algorithms, and algorithms to allow, enforce or reject.

The configurations are generally determined based on the following order:

  • Per-service configuration overrides
  • Service provider metadata (i.e. entity attributes, etc)
  • Global CAS default settings
  • OpenSAML initial defaults

In almost all cases, you should leave the defaults in place.

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

cas.authn.saml-idp.algs.override-allowed-algorithmsThe Override white listed algorithms.
no default

The Override white listed algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-allowed-signature-signing-algorithmsThe Override allowed signature signing algorithms.
no default

The Override allowed signature signing algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-blocked-encryption-algorithmsThe Override black listed encryption algorithms.
no default

The Override black listed encryption algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-blocked-signature-signing-algorithmsThe Override blocked signature signing algorithms.
no default

The Override blocked signature signing algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-data-encryption-algorithmsThe Override data encryption algorithms.
no default

The Override data encryption algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-key-encryption-algorithmsThe Override key encryption algorithms.
no default

The Override key encryption algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-signature-algorithmsThe Override signature algorithms.
no default

The Override signature algorithms.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-signature-canonicalization-algorithmThe Override signature canonicalization algorithm.
no default

The Override signature canonicalization algorithm.

Type
String
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.override-signature-reference-digest-methodsThe Override signature reference digest methods.
no default

The Override signature reference digest methods.

Type
List<String>
Default
none
Defined by
SamlIdPAlgorithmsProperties
cas.authn.saml-idp.algs.private-key-alg-nameAlgorithm name to use when generating or locating private key for signing operations..
RSA

Algorithm name to use when generating or locating private key for signing operations..

Type
String
Default
RSA
Defined by
SamlIdPAlgorithmsProperties

Required settings may be needed to activate or affect the feature; review them even when they have a default. Optional settings only need to be set to change a default or to turn on the behavior they control. Third party settings belong to libraries such as Spring Boot that CAS builds on; their own documentation may have more detail.

Notes on configuration

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.

:information_source: Note

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, especially 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.

Encryption

The following examples demonstrate encryption security configuration overrides per service provider.

  • The following example demonstrates how to configure CAS to use CBC encryption for a particular service provider:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    {
      "@class": "org.apereo.cas.support.saml.services.SamlRegisteredService",
      "serviceId": "sp.example.org",
      "name": "SAML",
      "id": 1,
      "metadataLocation": "/path/to/sp-metadata.xml",
      "encryptAssertions" : true,
      "encryptionDataAlgorithms": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2001/04/xmlenc#aes128-cbc"
        ]
      ],
      "encryptionKeyAlgorithms": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"
        ]
      ]
    }
    
  • The following example demonstrates how to configure CAS to use GCM encryption for a particular service provider:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    {
      "@class": "org.apereo.cas.support.saml.services.SamlRegisteredService",
      "serviceId": "sp.example.org",
      "name": "SAML",
      "id": 1,
      "metadataLocation": "/path/to/sp-metadata.xml",
      "encryptAssertions" : true,
      "encryptionDataAlgorithms": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2009/xmlenc11#aes128-gcm"
        ]
      ],
      "encryptionKeyAlgorithms": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"
        ]
      ]
    }
    

Note that encryption operations may also be activated and controlled using SAML2 metadata entity attributes.

1
2
3
4
5
6
7
8
<Extensions>
    <mdattr:EntityAttributes>
        <saml:Attribute Name="http://shibboleth.net/ns/profiles/encryptAssertions" 
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml:AttributeValue>true</saml:AttributeValue>
        </saml:Attribute>
    </mdattr:EntityAttributes>
</Extensions>

Signing

The following examples demonstrate signing security configuration overrides per service provider.

  • The following example demonstrates how to configure CAS to use SHA-1 signing and digest algorithms for a particular service provider:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    {
      "@class": "org.apereo.cas.support.saml.services.SamlRegisteredService",
      "serviceId": "sp.example.org",
      "name": "SAML",
      "id": 1,
      "metadataLocation": "/path/to/sp-metadata.xml",
      "signAssertions" : true,
      "signResponses" : true,
      "signingSignatureAlgorithms": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
          "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"
        ]
      ],
      "signingSignatureReferenceDigestMethods": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2000/09/xmldsig#sha1"
        ]
      ]
    }
    
  • The following example demonstrates how to configure CAS to use SHA-256 signing and digest algorithms for a particular service provider:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    {
      "@class": "org.apereo.cas.support.saml.services.SamlRegisteredService",
      "serviceId": "sp.example.org",
      "name": "SAML",
      "id": 1,
      "metadataLocation": "/path/to/sp-metadata.xml",
      "signAssertions" : true,
      "signResponses" : true,
      "signingSignatureAlgorithms": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
          "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"
        ]
      ],
      "signingSignatureReferenceDigestMethods": [
        "java.util.ArrayList",
        [
          "http://www.w3.org/2001/04/xmlenc#sha256"
        ]
      ]
    }
    

Note that signing operations may also be activated and controlled using SAML2 metadata entity attributes.

1
2
3
4
5
6
7
8
9
10
11
12
<Extensions>
    <mdattr:EntityAttributes>
        <saml:Attribute Name="http://shibboleth.net/ns/profiles/saml2/sso/browser/signResponses" 
                    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml:AttributeValue>true</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute Name="http://shibboleth.net/ns/profiles/saml2/sso/browser/signAssertions" 
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml:AttributeValue>true</saml:AttributeValue>
        </saml:Attribute>
    </mdattr:EntityAttributes>
</Extensions>

Troubleshooting

To enable additional logging, modify the logging configuration file to add the following:

1
2
3
4
5
6
7
8
9
<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>