Proxy Authentication

Proxy authentication support for CAS v1+ protocols is enabled by default, thus it is entirely a matter of CAS client configuration to leverage proxy authentication features.

Service Configuration

Note that each registered application in the registry must explicitly be configured to allow for proxy authentication. See this guide to learn about registering services in the registry.

Disabling proxy authentication components is recommended for deployments that wish to strategically avoid proxy authentication as a matter of security policy.

Use Case

One of the more common use cases of proxy authentication is the ability to obtain a ticket for a back-end [REST-based] service that is also protected by CAS. The scenario usually is:

  • User is faced with application A which is protected by CAS.
  • Application A on the backend needs to contact a service S to produce data.
  • Service S itself is protected by CAS itself.

Because A contacts service S via a server-to-service method where no browser is involved, service S would not be able to recognize that an SSO session already exists. In these cases, application A needs to exercise proxying in order to obtain a proxy ticket for service S. The proxy ticket is passed to the relevant endpoint of service S so it can retrieve and validate it via CAS and finally produce a response.

The trace route may look like this:

  1. Browser navigates to A.
  2. A redirects to CAS.
  3. CAS authenticates and redirects back to A with an ST.
  4. A attempts to validate the ST, and asks for a PGT.
  5. CAS confirms ST validation, and issues a proxy-granting ticket PGT.
  6. A asks CAS to produce a PT for service S, supplying the PGT in its request.
  7. CAS produces a PT for service S.
  8. A contacts the service S endpoint, passing along PT in the request.
  9. Service S attempts to validate the PT via CAS.
  10. CAS validates the PT and produces a successful response.
  11. Service S receives the response, and produces data for A.
  12. A receives and displays the data in the browser.

See the CAS Protocol for more info.

Handling SSL-enabled Proxy URLs

By default, CAS ships with a bundled HTTP client that is partly responsible to callback the URL for proxy authentication. Note that this URL need also be authorized by the CAS service registry before the callback can be made. See this guide for more info.

If the callback URL is authorized by the service registry, and if the endpoint is under HTTPS and protected by an SSL certificate, CAS will also attempt to verify the validity of the endpoint’s certificate before it can establish a successful connection. If the certificate is invalid, expired, missing a step in its chain, self-signed or otherwise, CAS will fail to execute the callback.

The HTTP client of CAS does present a local trust store that is similar to that of the Java platform. It is recommended that this trust store be used to handle the management of all certificates that need to be imported into the platform to allow CAS to execute the callback URL successfully. While by default, the local trust store to CAS is empty, CAS will still utilize both the default and the local trust store. The local trust store should only be used for CAS-related functionality of course, and the trust store file can be carried over across CAS and Java upgrades, and certainly managed by the source control system that should host all CAS configuration.

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.

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.

  • cas.http-client.allow-local-urls=false
  • Whether CAS should accept local URLs. For example http(s)://localhost/logout.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.async-timeout=PT5S
  • Indicates timeout for async operations.

    This settings supports the java.time.Duration syntax [?].

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.authority-validation-reg-ex-case-sensitive=true
  • Whether the regular expression specified with #authorityValidationRegex should be handled as case-sensitive (true) or case-insensitive (false). If no #authorityValidationRegex is set, this value does not have any effect.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.authority-validation-regex=
  • If specified the regular expression will be used to validate the url's authority.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.connection-timeout=PT5S
  • Connection timeout for all operations that reach out to URL endpoints.

    This settings supports the java.time.Duration syntax [?].

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.default-headers=
  • The default headers to use for any HTTP connection. This is defined as map, where the key is the header name and the value is the header value that should be sent along with request.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.host-name-verifier=default
  • Enable hostname verification when attempting to contact URL endpoints. May also be set to none to disable verification.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.proxy-host=
  • Send requests via a proxy; define the hostname.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.proxy-port=0
  • Send requests via a proxy; define the proxy port. Negative/zero values should deactivate the proxy configuration for the http client.

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.read-timeout=PT5S
  • Read timeout for all operations that reach out to URL endpoints.

    This settings supports the java.time.Duration syntax [?].

    org.apereo.cas.configuration.model.core.authentication.HttpClientProperties.

  • cas.http-client.truststore.file=
  • The CAS local truststore resource to contain certificates to the CAS deployment. In the event that local certificates are to be imported into the CAS running environment, a local truststore is provided by CAS to improve portability of configuration across environments.

    org.apereo.cas.configuration.model.core.authentication.HttpClientTrustStoreProperties.

  • cas.http-client.truststore.psw=changeit
  • The truststore password.

    org.apereo.cas.configuration.model.core.authentication.HttpClientTrustStoreProperties.

  • cas.http-client.truststore.type=
  • Truststore type used to create a SSL context for http client.

    org.apereo.cas.configuration.model.core.authentication.HttpClientTrustStoreProperties.

    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.S ettings 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. The validation process is on by default and can be skipped on startup using a special system property SKIP_CONFIG_VALIDATION that should be set to true. 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