---
apiVersion: 'v1'
kind:       'ConfigMap'
metadata:
  name: 'cas-config'
data:
  cas.properties: |-
    cas.host.name     = {{ .Values.config.casProperties.hostName     }}
    cas.server.name   = {{ .Values.config.casProperties.serverName   }}
    cas.server.prefix = {{ .Values.config.casProperties.serverPrefix }}

    # https://apereo.github.io/cas/6.2.x/services/JSON-Service-Management.html#json-service-registry
    # https://apereo.github.io/cas/6.2.x/services/AutoInitialization-Service-Management.html#service-registry-initialization
    # https://apereo.github.io/cas/6.2.x/configuration/Configuration-Properties.html#service-registry
    cas.service-registry.json.location=file:/etc/cas/services
    cas.service-registry.init-from-json=true
    cas.service-registry.watcher-enabled=false

    cas.authn.accept.users=
    cas.authn.accept.name=
    cas.authn.accept.credentialCriteria=

    # LDAP authentication
    # https://apereo.github.io/cas/6.2.x/configuration/Configuration-Properties.html#ldap-authentication
    cas.authn.ldap[0].type                   = {{ .Values.config.casProperties.ldap.type                   }}
    cas.authn.ldap[0].ldapUrl                = {{ .Values.config.casProperties.ldap.url                    }}
    cas.authn.ldap[0].connectionStrategy     = {{ .Values.config.casProperties.ldap.ConnectStrategy        }}
    cas.authn.ldap[0].useSsl                 = {{ .Values.config.casProperties.ldap.SSL                    }}
    cas.authn.ldap[0].useStartTls            = {{ .Values.config.casProperties.ldap.StartTLS               }}
    cas.authn.ldap[0].baseDn                 = {{ .Values.config.casProperties.ldap.baseDN                 }}
    cas.authn.ldap[0].searchFilter           = {{ .Values.config.casProperties.ldap.searchFilter           }}
    cas.authn.ldap[0].bindDn                 = {{ .Values.config.casProperties.ldap.bindDN                 }}
    cas.authn.ldap[0].bindCredential         = {{ .Values.config.casProperties.ldap.bindCredential         }}
    cas.authn.ldap[0].dnFormat               = {{ .Values.config.casProperties.ldap.dnFormat               }}
    cas.authn.ldap[0].principalAttributeId   = {{ .Values.config.casProperties.ldap.PrincipalAttributeId   }}
    cas.authn.ldap[0].principalAttributeList = {{ .Values.config.casProperties.ldap.PrincipalAttributeList }}

    # OpenID
    # https://apereo.github.io/cas/6.2.x/installation/OIDC-Authentication.html
    # https://apereo.github.io/cas/6.2.x/configuration/Configuration-Properties.html#openid-connect
    cas.authn.oidc.jwksFile=file:/etc/cas/openid.jwks
    cas.authn.oidc.issuer={{ .Values.config.casProperties.serverPrefix }}/oidc
    cas.authn.oidc.claims=email
    cas.authn.oidc.dynamicClientRegistrationMode=PROTECTED

    # SAML
    # https://apereo.github.io/cas/6.2.x/integration/Configuring-SAML-SP-Integrations.html
    # https://apereo.github.io/cas/6.2.x/configuration/Configuration-Properties.html#saml-idp
    # https://apereo.github.io/cas/6.2.x/configuration/Configuration-Properties-Common.html#saml2-service-provider-integrations
    cas.authn.saml-idp.entity-id = {{ .Values.config.casProperties.hostName }}{{ .Values.config.casProperties.base_uri }}
    cas.authn.saml-idp.metadata.location=file:/etc/cas/saml

    cas.webflow.crypto.signing.key    = {{ .Values.config.casProperties.crypto.webflowSigningKey }}
    cas.webflow.crypto.encryption.key = {{ .Values.config.casProperties.crypto.webflowEncryptionKey }}
    cas.tgc.crypto.signing.key        = {{ .Values.config.casProperties.crypto.tgcSigningKey }}
    cas.tgc.crypto.encryption.key     = {{ .Values.config.casProperties.crypto.tgcEncryptionKey }}

    logging.level.org.apereo.cas=WARN

    server.servlet.context-path={{ .Values.config.casProperties.base_uri }}
    server.port=8080
    server.ssl.enabled=false

    cas.server.tomcat.serverName=City of Bloomington CAS
    cas.server.tomcat.basicAuthn.enabled=false
    cas.server.tomcat.http.enabled=false
    cas.server.tomcat.http.port=8080
    cas.server.tomcat.http.protocol=org.apache.coyote.http11.Http11NioProtocol
    cas.server.tomcat.http.attributes.attributeName=attributeValue

    cas.server.tomcat.httpProxy.enabled=false
    cas.server.tomcat.httpProxy.secure=true
    cas.server.tomcat.httpProxy.protocol=org.apache.coyote.http11.Http11NioProtocol
    cas.server.tomcat.httpProxy.scheme=https
    cas.server.tomcat.httpProxy.attributes.attributeName=attributeValue

    #server.ssl.keystoreType     = PKCS12
    #server.ssl.keystore         = {{ .Values.config.casProperties.ssl.keyStoreLocation }}
    #server.ssl.keystorePassword = {{ .Values.config.casProperties.ssl.keyStorePassword }}
...
