Service HTTP Security Headers
CAS has ability to control, on a per-service basis, whether certain security-related HTTP headers should be injected into the response. While headers are typically enabled and defined globally as part of the CAS Security Filter, the strategy described here allows one to disable/enable the injection of these headers for certain applications and service requests and override the global defaults.
Global Configuration
The following settings and properties are available from the CAS configuration catalog:
cas.http-web-request.cors.enabled=false
Whether CORS should be enabled for http requests.
CAS Property:
|
1 |
cas.http-web-request.cors.enabled=... |
cas:
http-web-request:
cors:
enabled: "..."
1
java -Dcas.http-web-request.cors.enabled="..." -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_HTTP_WEB_REQUEST_CORS_ENABLED="..."
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.http-web-request.cors.enabled="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.http-web-request.header.enabled=true
Allow CAS to inject and enforce http security headers via an http filter that are outlined here for caching, HSTS, etc.
org.apereo.cas.configuration.model.core.web.security.HttpHeadersRequestProperties.
CAS Property: cas.http-web-request.header.enabled

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.http-web-request.header.enabled=true
cas:
http-web-request:
header:
enabled: "true"
1
java -Dcas.http-web-request.header.enabled="true" -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_HTTP_WEB_REQUEST_HEADER_ENABLED="true"
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.http-web-request.header.enabled="true"
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.http-web-request.allow-multi-value-parameters=false
Whether CAS should accept multi-valued parameters in incoming requests. Example block would to prevent requests where more than one
CAS Property:
|
1 |
cas.http-web-request.allow-multi-value-parameters=... |
cas:
http-web-request:
allow-multi-value-parameters: "..."
1
java -Dcas.http-web-request.allow-multi-value-parameters="..." -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_HTTP_WEB_REQUEST_ALLOW_MULTI_VALUE_PARAMETERS="..."
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.http-web-request.allow-multi-value-parameters="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.http-web-request.characters-to-forbid=none
Characters to block in incoming requests. none
is a special value. Separate characters by a space.
org.apereo.cas.configuration.model.core.web.security.HttpRequestProperties.
CAS Property: cas.http-web-request.characters-to-forbid

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.http-web-request.characters-to-forbid=none
cas:
http-web-request:
characters-to-forbid: "none"
1
java -Dcas.http-web-request.characters-to-forbid="none" -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_HTTP_WEB_REQUEST_CHARACTERS_TO_FORBID="none"
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.http-web-request.characters-to-forbid="none"
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.http-web-request.cors.allow-credentials=true
The Access-Control-Allow-Credentials header Indicates whether or not the response to the request can be exposed when the credentials flag is true. When used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. Note that simple GET requests are not preflighted, and so if a request is made for a resource with credentials, if this header is not returned with the resource, the response is ignored by the browser and not returned to web content.
org.apereo.cas.configuration.model.core.web.security.HttpCorsRequestProperties.
CAS Property: cas.http-web-request.cors.allow-credentials

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.http-web-request.cors.allow-credentials=true
cas:
http-web-request:
cors:
allow-credentials: "true"
1
java -Dcas.http-web-request.cors.allow-credentials="true" -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_HTTP_WEB_REQUEST_CORS_ALLOW_CREDENTIALS="true"
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.http-web-request.cors.allow-credentials="true"
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.http-web-request.cors.allow-headers=
The Access-Control-Allow-Headers header is used in response to a preflight request to indicate which HTTP headers can be used when making the actual request. Default is everything.
org.apereo.cas.configuration.model.core.web.security.HttpCorsRequestProperties.
CAS Property: cas.http-web-request.cors.allow-headers

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.http-web-request.cors.allow-headers=...
cas:
http-web-request:
cors:
allow-headers: "..."
1
java -Dcas.http-web-request.cors.allow-headers="..." -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_HTTP_WEB_REQUEST_CORS_ALLOW_HEADERS="..."
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.http-web-request.cors.allow-headers="..."
cas.war
with an embedded server container and can be found in the build/libs
directory.
cas.http-web-request.cors.allow-methods=
The Access-Control-Allow-Methods header specifies the method or methods allowed when accessing the resource. This is used in response to a pre-flight request. The conditions under which a request is pre-flighted are discussed above. Default is everything.
org.apereo.cas.configuration.model.core.web.security.HttpCorsRequestProperties.
CAS Property: cas.http-web-request.cors.allow-methods

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.http-web-request.cors.allow-methods=...
cas:
http-web-request:
cors:
allow-methods: "..."
1
java -Dcas.http-web-request.cors.allow-methods="..." -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_HTTP_WEB_REQUEST_CORS_ALLOW_METHODS="..."
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.http-web-request.cors.allow-methods="..."
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.
Service HTTP Headers
The following properties are available and recognized by CAS for various modules and features:
Name | Default Value | Type | Group |
---|---|---|---|
httpHeaderEnableCacheControl
|
true
|
BOOLEAN
|
HTTP_HEADERS
|
httpHeaderEnableContentSecurityPolicy
|
true
|
STRING
|
HTTP_HEADERS
|
httpHeaderEnableStrictTransportSecurity
|
true
|
BOOLEAN
|
HTTP_HEADERS
|
httpHeaderEnableXContentOptions
|
true
|
BOOLEAN
|
HTTP_HEADERS
|
httpHeaderEnableXFrameOptions
|
true
|
BOOLEAN
|
HTTP_HEADERS
|
A sample JSON file follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"@class" : "org.apereo.cas.services.CasRegisteredService",
"serviceId" : "^https://.+",
"name" : "sample service",
"id" : 100,
"properties" : {
"@class" : "java.util.HashMap",
"httpHeaderEnableXContentOptions" : {
"@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty",
"values" : [ "java.util.HashSet", [ "true" ] ]
}
}
}
CORS Policies
Cross-origin resource sharing (CORS) policies can also be defined per application in form of service properties.
The following properties are available and recognized by CAS for various modules and features:
Name | Default Value | Type | Group |
---|---|---|---|
corsAllowCredentials
|
false
|
BOOLEAN
|
CORS
|
corsAllowedHeaders
|
|
STRING
|
CORS
|
corsAllowedMethods
|
|
STRING
|
CORS
|
corsAllowedOriginPatterns
|
|
STRING
|
CORS
|
corsAllowedOrigins
|
|
STRING
|
CORS
|
A sample JSON file follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"@class" : "org.apereo.cas.services.CasRegisteredService",
"serviceId" : "^https://.+",
"name" : "sample service",
"id" : 100,
"properties" : {
"@class" : "java.util.HashMap",
"corsMaxAge" : {
"@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty",
"values" : [ "java.util.HashSet", [ "1000" ] ]
}
}
}