Overview

CAS takes advantages of Swagger to produce API documentation automatically. The generated documentation supports all CAS endpoints and REST APIs provided they are made available to the runtime application context and are present in the overlay.

Support is enabled by including the following dependency in the overlay:

1
2
3
4
5
<dependency>
  <groupId>org.apereo.cas</groupId>
  <artifactId>cas-server-support-swagger</artifactId>
  <version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-swagger:${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-swagger"
}

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. You should only include this field in your configuration if you need to modify the default value.

The configuration settings listed below are tagged as Third Party in the CAS configuration metadata. This flag indicates that the configuration setting is not controlled, owned or managed by the CAS ecosystem, and affects functionality that is offered by a third-party library, such as Spring Boot or Spring Cloud to CAS. For additional info, you might have to visit the third-party source to find more details.

  • springdoc.api-docs.enabled=true
  • Whether to generate and serve an OpenAPI document.

    org.springdoc.core.SpringDocConfigProperties$ApiDocs.

  • springdoc.api-docs.groups.enabled=false
  • The Enabled.

    org.springdoc.core.SpringDocConfigProperties$Groups.

  • springdoc.api-docs.path=
  • Path to the generated OpenAPI documentation. For a yaml file, append ".yaml" to the path.

    org.springdoc.core.SpringDocConfigProperties$ApiDocs.

  • springdoc.api-docs.resolve-schema-properties=false
  • The Resolve schema properties.

    org.springdoc.core.SpringDocConfigProperties$ApiDocs.

  • springdoc.api-docs.version=
  • The OpenAPI version.

    org.springdoc.core.SpringDocConfigProperties$ApiDocs.

  • springdoc.auto-tag-classes=true
  • The Auto tag classes.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.cache.disabled=false
  • The Disabled.

    org.springdoc.core.SpringDocConfigProperties$Cache.

  • springdoc.consumes-to-match=
  • The Consumes to match.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.default-consumes-media-type=
  • The Default consumes media type.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.default-flat-param-object=false
  • The param default flatten

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.default-produces-media-type=
  • The Default produces media type.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.default-support-form-data=false
  • convert query param to form data when consumes is multipart/form-data

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.disable-i18n=false
  • The Disable i18n.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.group-configs=
  • The Group configs.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.headers-to-match=
  • The Headers to match.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.model-and-view-allowed=false
  • The Model and view allowed.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.model-converters.deprecating-converter.enabled=false
  • The Enabled.

    org.springdoc.core.SpringDocConfigProperties$ModelConverters$DeprecatingConverter.

  • springdoc.model-converters.pageable-converter.enabled=false
  • The Enabled.

    org.springdoc.core.SpringDocConfigProperties$ModelConverters$PageableConverter.

  • springdoc.model-converters.polymorphic-converter.enabled=false
  • The Enabled.

    org.springdoc.core.SpringDocConfigProperties$ModelConverters$PolymorphicConverter.

  • springdoc.override-with-generic-response=
  • The Override with generic response.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.packages-to-exclude=
  • The Packages to exclude.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.packages-to-scan=
  • The Packages to scan.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.paths-to-exclude=
  • The Paths to exclude.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.paths-to-match=
  • The Paths to match.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.pre-loading-enabled=false
  • Allow for pre-loading OpenAPI

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.produces-to-match=
  • The Produces to match.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.remove-broken-reference-definitions=true
  • The Remove broken reference definitions.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.show-actuator=false
  • The Show actuator.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.show-login-endpoint=false
  • The Show login endpoint.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.show-spring-cloud-functions=false
  • The Show spring cloud functions.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.sort-converter.enabled=false
  • The Enabled.

    org.springdoc.core.SpringDocConfigProperties$ModelConverters$SortConverter.

  • springdoc.swagger-ui.config-url=
  • URL to fetch external configuration document from.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.csrf.cookie-name=
  • The Cookie name.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.csrf.enabled=false
  • The Enabled.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.csrf.header-name=
  • The Header name.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.csrf.local-storage-key=
  • The Local storage key.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.csrf.session-storage-key=
  • The Session storage key.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.csrf.use-local-storage=false
  • Use Local storage.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.csrf.use-session-storage=false
  • Use Session storage.

    org.springdoc.core.SwaggerUiConfigProperties$Csrf.

  • springdoc.swagger-ui.deep-linking=
  • Enables or disables deep linking for tags and operations. @see deep-linking.md

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.default-model-expand-depth=
  • The default expansion depth for the model on the model-example section.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.default-model-rendering=
  • Controls how the model is shown when the API is first rendered.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.default-models-expand-depth=
  • The default expansion depth for models (set to -1 completely hide the models).

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.disable-swagger-default-url=false
  • The Disable swagger default url.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.display-operation-id=
  • Controls the display of operationId in operations list.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.display-request-duration=
  • Controls the display of the request duration (in milliseconds) for Try-It-Out requests.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.doc-expansion=
  • Controls the default expansion setting for the operations and tags.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.enabled=true
  • Whether to generate and serve an OpenAPI document.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.filter=
  • If set, enables filtering. The top bar will show an edit box that could be used to filter the tagged operations that are shown.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.groups-order=
  • The Groups order.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.layout=
  • The name of a component available via the plugin system to use as the top-level layout for Swagger UI.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.max-displayed-tags=
  • If set, limits the number of tagged operations displayed to at most this many.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.oauth.additional-query-string-params=
  • The Additional query string params.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.app-name=
  • The App name.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.client-id=
  • The Client id.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.client-secret=
  • The Client secret.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.config-parameters=
  • org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.realm=
  • The Realm.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.scope-separator=
  • The Scope separator.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.scopes=
  • The Scopes selected by default upon authentication.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.use-basic-authentication-with-access-code-grant=
  • The Use basic authentication with access code grant.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth.use-pkce-with-authorization-code-grant=
  • The Use pkce with authorization code grant.

    org.springdoc.core.SwaggerUiOAuthProperties.

  • springdoc.swagger-ui.oauth2-redirect-url=
  • OAuth redirect URL.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.operations-sorter=
  • Apply a sort to the operation list of each API

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.path=
  • The path for the Swagger UI pages to load. Will redirect to the springdoc.webjars.prefix property.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.persist-authorization=
  • The Persist authorization.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.query-config-enabled=
  • The Query config enabled.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.show-common-extensions=
  • Controls the display of extensions

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.show-extensions=
  • Controls the display of vendor extension (x-) fields and values.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.supported-submit-methods=
  • The supported try it out methods

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.syntax-highlight.activated=
  • The Activated.

    org.springdoc.core.SwaggerUiConfigProperties$SyntaxHighlight.

  • springdoc.swagger-ui.syntax-highlight.theme=
  • The Theme.

    org.springdoc.core.SwaggerUiConfigProperties$SyntaxHighlight.

  • springdoc.swagger-ui.tags-sorter=
  • Apply a sort to the tag list of each API

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.try-it-out-enabled=
  • Try it out enabled

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.url=
  • The Url.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.urls=
  • The Urls.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.urls-primary-name=
  • The Urls primary name.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.use-root-path=false
  • The Use root path.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.validator-url=
  • URL to validate specs against.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.version=
  • The Swagger ui version.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.swagger-ui.with-credentials=
  • The With credentials.

    org.springdoc.core.SwaggerUiConfigProperties.

  • springdoc.use-fqn=false
  • Use fully qualified name

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.use-management-port=false
  • If set to true, exposes the swagger-ui on the actuator management port.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.webjars.prefix=
  • The Prefix.

    org.springdoc.core.SpringDocConfigProperties$Webjars.

  • springdoc.writer-with-default-pretty-printer=false
  • The Writer with default pretty printer.

    org.springdoc.core.SpringDocConfigProperties.

  • springdoc.writer-with-order-by-keys=false
  • The Writer with order by keys.

    org.springdoc.core.SpringDocConfigProperties.

    If you need to design your own password encoding scheme where the type is specified as a fully qualified Java class name, the structure of the class would be similar to the following:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    package org.example.cas;
    
    import org.springframework.security.crypto.codec.*;
    import org.springframework.security.crypto.password.*;
    
    public class MyEncoder extends AbstractPasswordEncoder {
        @Override
        protected byte[] encode(CharSequence rawPassword, byte[] salt) {
            return ...
        }
    }
    

    If you need to design your own password encoding scheme where the type is specified as a path to a Groovy script, the structure of the script would be similar to the following:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    import java.util.*
    
    byte[] run(final Object... args) {
        def rawPassword = args[0]
        def generatedSalt = args[1]
        def logger = args[2]
        def casApplicationContext = args[3]
    
        logger.debug("Encoding password...")
        return ...
    }
    
    Boolean matches(final Object... args) {
        def rawPassword = args[0]
        def encodedPassword = args[1]
        def logger = args[2]
        def casApplicationContext = args[3]
    
       logger.debug("Does match or not ?");
       return ...
    

    Password Policy Strategies

    If the password policy strategy is to be handed off to a Groovy script, the outline of the script may be as follows:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    import java.util.*
    import org.ldaptive.auth.*
    import org.apereo.cas.*
    import org.apereo.cas.authentication.*
    import org.apereo.cas.authentication.support.*
    
    List<MessageDescriptor> run(final Object... args) {
        def response = args[0]
        def configuration = args[1];
        def logger = args[2]
        def applicationContext = args[3]
    
        logger.info("Handling password policy [{}] via ${configuration.getAccountStateHandler()}", response)
    
        def accountStateHandler = configuration.getAccountStateHandler()
        return accountStateHandler.handle(response, configuration)
    }
    

    The parameters passed are as follows:

    Parameter Description
    response The LDAP authentication response of type org.ldaptive.auth.AuthenticationResponse
    configuration The LDAP password policy configuration carrying the account state handler defined.
    logger The object responsible for issuing log messages such as logger.info(...).

    Authentication handlers that generally deal with username-password credentials can be configured to transform the user id prior to executing the authentication sequence. Each authentication strategy in CAS provides settings to properly transform the principal. Refer to the relevant settings for the authentication strategy at hand to learn more.

    Authentication handlers as part of principal transformation may also be provided a path to a Groovy script to transform the provided username. The outline of the script may take on the following form:

    1
    2
    3
    4
    5
    
    String run(final Object... args) {
        def providedUsername = args[0]
        def logger = args[1]
        return providedUsername.concat("SomethingElse")
    }
    

    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.

    Endpoints

    The following Swagger endpoints may be used to analyze and test the APIs:

    Description URL
    Swagger API Specification https://sso.example.org/cas/v3/api-docs
    Swagger UI https://sso.example.org/cas/swagger-ui.html