Service Management

The CAS service management facility allows CAS server administrators to declare and configure which services (CAS clients) may make use of CAS in which ways. The core component of the service management facility is the service registry that stores one or more registered services containing metadata that drives a number of CAS behaviors.

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

cas.service-registry.core.index-servicesWhen set to true, CAS creates in-memory indexes for specific pre-chosen fields of the registered services, allowing it to find a service definition by its friendly name, client id, etc.
true

When set to true, CAS creates in-memory indexes for specific pre-chosen fields of the registered services, allowing it to find a service definition by its friendly name, client id, etc. This is particularly useful for querying operations in OAuth or OpenID Connect, as there would be no need to loop through all service definitions looking for a matching client id. The indexes allow CAS to execute a direct query on loaded service objects to find the relevant definition.

Type
Boolean
Default
true
Defined by
ServiceRegistryCoreProperties
cas.service-registry.core.init-default-servicesFlag that indicates whether service definitions that ship with CAS by default should be included in the initialization process and imported into CAS service registry.
true

Flag that indicates whether service definitions that ship with CAS by default should be included in the initialization process and imported into CAS service registry. Default service files that ship with CAS are found on the classpath inside the JsonServiceRegistryProperties#DEFAULT_LOCATION_DIRECTORY directory.

Type
Boolean
Default
true
Defined by
ServiceRegistryCoreProperties
cas.service-registry.core.init-from-jsonFlag that indicates whether to initialise active service registry implementation with a set of service definitions included with CAS by default in JSON format.
false

Flag that indicates whether to initialise active service registry implementation with a set of service definitions included with CAS by default in JSON format. The initialization generally tends to find JSON service definitions from JsonServiceRegistryProperties#getLocation().

In cases where the location points to an embedded directory or resource inside a JAR/ZIP file, such as those that might have been packaged with the CAS application as part of the build and assembly process, embedded services are first exported out into a temporary directory and then read as file-system resources. In such scenarios, you may want to turn off the watcher via JsonServiceRegistryProperties#isWatcherEnabled().

If the default location offered by CAS, JsonServiceRegistryProperties#DEFAULT_LOCATION_DIRECTORY, is used, CAS would attempt to locate JSON service files by forming the following pattern for each active spring application profile:
classpath*:/JsonServiceRegistryProperties#DEFAULT_LOCATION_DIRECTORY/profile-id/*.json

You may also control whether default services should be included and initialized via #isInitDefaultServices().

Type
Boolean
Default
false
Defined by
ServiceRegistryCoreProperties

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.

Actuator Endpoints

The following endpoints are provided by CAS:

registeredServices
CAS endpoint12 operationsNot exposed by defaultcas-server-support-reports
base path /cas/actuator/
serviceAccess
CAS endpoint1 operationNot exposed by defaultcas-server-support-reports
1

Include the module that provides these endpoints in the WAR overlay:

1
2
3
4
5
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-reports</artifactId>
    <version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-reports:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
    imports {
        mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
    }
}

dependencies {
    implementation "org.apereo.cas:cas-server-support-reports"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
    /*
        The following platform references are included automatically and are listed for reference only.

        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-reports"
}
2

Turn the endpoints on and expose them over the web. One entry covers every operation. By default only info, health and status are exposed.

1
2
3
management.endpoint.registeredServices.access=UNRESTRICTED
management.endpoint.serviceAccess.access=UNRESTRICTED
management.endpoints.web.exposure.include=registeredServices,serviceAccess

Endpoints may be mapped to other paths. For example, to serve health at healthcheck:

1
management.endpoints.web.path-mapping.health=healthcheck

Registered Services

Registered services present the following metadata:

Field Description
id Required unique identifier. This MUST be a valid numeric value.
name Required name (255 characters or less).
description Optional free-text description of the service. (255 characters or less)
informationUrl Optional free-text link to the service information guide.
privacyUrl Optional free-text link to the service privacy policy.
redirectUrl Optional URL to use when returning an authentication response back to applications.
logo Optional path to an image file that is the logo for this service. The image will be displayed on the login page along with the service description and name. The value may be a relative path to the images directory of the CAS web application or it may be a full URL.
serviceId Required regular expression describing a logical service. A logical service defines one or more URLs where a service or services are located. The definition of the url pattern must be done carefully because it can open security breaches.
locale Optional locale name that may be used to customize the CAS UI when the service requests a ticket. Values can use the Spring Expression Language syntax. See this guide for more details.
theme Optional theme name that may be used to customize the CAS UI when the service requests a ticket. Values can use the Spring Expression Language syntax. See this guide for more details.
proxyPolicy Determines whether the service is able to proxy authentication. See this guide for more info.
evaluationOrder Determines relative order of evaluation of registered services. This flag is particularly important in cases where two service URL expressions cover the same services; evaluation order determines which registration is evaluated first and acts as an internal sorting factor.
authenticationPolicy The authentication policy to act as a complement or override for the global authentication engine. See this guide for more details.
attributeReleasePolicy The policy that describes the set of attributes allowed to be released to the application, as well as any other filtering logic needed to weed some out. See this guide for more details on attribute release and filters.
logoutType Defines how this service should be treated once the logout protocol is initiated. Acceptable values are LogoutType.BACK_CHANNEL, LogoutType.FRONT_CHANNEL or LogoutType.NONE. See this guide for more details on logout.
responseType Defines how CAS should respond to requests for this service. See this guide for more details.
usernameAttributeProvider The provider configuration which dictates what value as the “username” should be sent back to the application. See this guide for more details on attribute release and filters.
accessStrategy The strategy configuration that outlines and access rules for this service. It describes whether the service is allowed, authorized to participate in SSO, or can be granted access from the CAS perspective based on a particular attribute-defined role, aka RBAC. See this guide for more details on attribute release and filters.
publicKey The public key associated with this service that is used to authorize the request by encrypting certain elements and attributes in the CAS validation protocol response, such as the PGT or the credential. See this guide for more details on attribute release and filters.
logoutUrl URL endpoint for this service to receive logout requests. See this guide for more details
properties Extra metadata associated with this service in form of key/value pairs. This is used to inject custom fields into the service definition, to be used later by extension modules to define additional behavior on a per-service basis. See this guide for more info please.
multifactorPolicy The policy that describes the configuration required for this service authentication, typically for multifactor authentication.
contacts Specify the collection of contacts associated with service that own the application. See this guide for more info.
matchingStrategy Specify the strategy used to match the service definition against an authentication request. See this guide for more info.
supportedProtocols Specify supported and allowed protocols for this service. See this guide for more info.
templateName Name of the template service definition to use as a blueprint, when constructing this service definition.
:information_source: Service Types

Note that while the above properties apply to all generic service definitions, there are additional service types in CAS that may be activated and required depending on the protocol used and the nature of the client application. Always check the dedicated guide for the capability you have in mind (i.e. OAuth, SAML, etc).

Storage

The following options may be used to store services in CAS.

Storage Kind Shared across nodes Notes
In memory Code Built into each node Definitions are Spring beans in your overlay; changes need a rebuild and restart.
JSON Files No, replicate them Files are watched and reloaded when they change.
YAML Files No, replicate them Same as JSON.
Git Repository Yes, through the remote repository Each node clones the repository and pulls changes; history comes with Git.
JPA Database Yes Relational databases such as Oracle, MySQL or PostgreSQL.
MongoDb Database Yes  
Redis Database Yes  
LDAP Directory Yes Definitions are stored as directory entries.
DynamoDb Database Yes  
Apache Cassandra Database Yes  
Google Cloud Firestore Database Yes  
Amazon S3 Object storage Yes  
Google Cloud Storage Object storage Yes  
REST Your API Yes, through your API You implement the storage behind a REST API.
Custom Your code Depends on your implementation You implement the registry with CAS APIs.
Azure CosmosDb Database Yes Deprecated.

Service definitions are cached by each node and reloaded on a schedule; see caching and reloading. The Palantir dashboard can edit definitions in any registry that accepts writes.

How Do I Choose?

There are is a wide range of service registries on the menu. The selection criteria is outlined below:

  • Choose a technology that you are most familiar with and have the skills and patience to troubleshoot, tune and scale for the win.
  • Choose a technology that does not force your CAS configuration to be tied to any individual servers/nodes in the cluster, as this will present auto-scaling issues and manual effort.
  • Choose a technology that works well with your network and firewall configuration and is performant and reliable enough based on your network topology.
  • Choose a technology that shows promising results under your expected load, having run performance and stress tests.
  • Choose a technology that does not depend on outside processes, systems and manual work as much as possible, is self-reliant and self contained.