Configuration Management
The core foundations of CAS that deal with configuration management, settings and replication of changes across multiple CAS nodes are all entirely handled automatically via the Spring Cloud project. The strategies listed below present a very flexible and powerful way to manage CAS configuration for production deployments, by allowing the CAS adopter to ONLY keep track of settings required for their specific deployment concerns and leaving all else behind to be handled by the default CAS configuration.
The following strategies may be used to fully extend the CAS configuration model.
CAS configuration allows for both YAML and Properties syntax in any of the below strategies used. It generally does not matter which syntax is used, but when working with Unicode strings as properties values it does matter. Spring loads properties files using the `ISO-8859-1` encoding. YAML files are loaded with UTF-8 encoding. If you are setting Unicode values try using a YAML configuration file.
The following settings and properties are available from the CAS configuration catalog:
cas.server.name=https://cas.example.org:8443
Full name of the CAS server. This is the public-facing address of the CAS deployment and not the individual node address, in the event that CAS is clustered.
|
cas.server.prefix=
A concatenation of the server name plus the CAS context path. Deployments at root likely need to blank out this value. This setting supports the Spring Expression Language.
|
cas.server.scope=example.org
The CAS Server scope. This setting supports the Spring Expression Language.
|
cas.host.name=
Name of the networking host configured to run CAS server. A CAS host is automatically appended to the ticket ids generated by CAS. If none is specified, one is automatically detected and used by CAS.
|
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. 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 [0]
is meant to be
incremented by the adopter to allow for distinct multiple configuration blocks.
On startup, CAS will display a banner along with some diagnostics info.
In order to skip this step and summarize, set the system property -DCAS_BANNER_SKIP=true
.
On startup, CAS will perform many tasks related to the application lifecycle, the beans lifecycle
or even processing application events. Such events can be tracked at startup and collected
for profiling purposes to have a better understanding of the application startup process.
Startup event tracking can be controlled using a system property -DCAS_APP_STARTUP
that can be assigned the following values:
Type | Description |
---|---|
default |
Default startup type which acts as a no-op. |
buffering |
Record events into memory using a pre-defined capacity and expose them via the startup actuator endpoint. |
jfr |
Add startup events to a Java Flight Recorder session for profiling applications and correlating their Spring context lifecycle. |
Overview
CAS allows you to externalize your configuration so you can work with the same CAS instance in different environments. You can use properties files, YAML files, environment variables and command-line arguments to externalize configuration.
CAS uses a very particular order that is designed to allow sensible overriding of values. Properties passed to the CAS web application are considered in the following order:
- Command line arguments, starting with
--
(e.g.--server.port=9000
) - Properties from
SPRING_APPLICATION_JSON
(inline JSON embedded in an environment variable/system property) - JNDI attributes from
java:comp/env
. - Configuration files (i.e.
application.properties|yml
) indicated by the configuration server and profile. - OS environment variables.
- Java System properties.
In order to manage the CAS configuration, you should configure access to CAS administration panels.
Actuator Endpoints
The following endpoints are provided:
Configuration Server
CAS provides a built-in configuration server that is responsible for bootstrapping the configuration environment and loading of externalized settings in a distributed system. You may have a central place to manage external properties for CAS nodes across all environments. To learn more about how to manage the CAS configuration, please review this guide.
Extending CAS Configuration
To learn more about how to extend and customize the CAS configuration, please review this guide.
Custom CAS Settings
The following settings and properties are available from the CAS configuration catalog:
cas.custom.properties=
Collection of custom settings that can be utilized for a local deployment. The settings should be available to CAS views and webflows for altering UI and/or introducing custom behavior to any extended customized component without introducing a new property namespace. This is defined as a map, where the key should be the setting name and the value should be the setting value.
|
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. 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 [0]
is meant to be
incremented by the adopter to allow for distinct multiple configuration blocks.
Auto Configuration Strategy
Note that CAS in most if not all cases will attempt to auto-configure the context based on the declaration and presence of feature-specific dedicated modules. This generally SHOULD relieve the deployer from manually massaging the application context via XML configuration files.
The idea is twofold:
- Declare your intention for a given CAS feature by declaring the appropriate module in your overlay.
- Optionally, configure the appropriate properties and settings.
CAS will automatically take care of injecting appropriate beans and other components into the runtime application context, Depending on the presence of a module and/or its settings configured by the deployer.
Again, the entire point of the auto-configuration strategy is ensure deployers aren't swimming in a sea of XML files configuring beans and such. CAS should take care of it all. If you find an instance where this claim does not hold, consider that a "bug" and file a feature request.