CAS external configuration - AtlasOfLivingAustralia/ala-cas Wiki

###Introduction Hack to allow cas configuration to be loaded via a .properties file.

###Details There is a new version of the ALA CAS Client that allows configuration to be externalised in a .properties file. CAS will look for the properties file to be supplied as JNDI environment variable.
To use this:
1. Include the correct version in your pom.xml

        <dependency>
            <groupId>au.org.ala</groupId>
            <artifactId>ala-cas-client</artifactId>
            <version>2.0-SNAPSHOT</version>
            <type>jar</type>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

2. Include the JNDI environment variable in the web.xml

<!--  Set up the default JNDI entry for the prepertiesFile -->
    <env-entry>
        <env-entry-name>configPropFile</env-entry-name>
        <env-entry-value>/data/hubs/config/hubs-config.properties</env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

3. Add the external configuration to the properties file

serverName=http://ozcam.ala.org.au
casServerName=https://auth.ala.org.au
uriFilterPattern=/occurrence/.*, /admin, /admin/edit*, /admin/upload, /admin/multiUpload, /admin/multiUpload/.*,/admin/optimise,/admin/reloadAllRanks,/admin/loadCaab,/admin/reloadCollections,/admin/reloadInstitutions,/admin/reloadDataProviders,/admin/reloadDataResources
uriExclusionFilterPattern=/occurrences/shapeUpload,/images.*,/css.*,/js.*,.*json,/help/.*
authenticateOnlyIfLoggedInFilterPattern=/occurrences/.*,/explore/your-area,/query,/proxy/download/.*,/
casServerLoginUrl=https://auth.ala.org.au/cas/login
gateway=true
casServerUrlPrefix=https://auth.ala.org.au/cas

###Trouble shooting Sometime non CAS properties can prevent the upstream filters from performing correctly. If you find you are having issue configure the list of properties that CAS should use in the .properies file:

casProperties=casServerLoginUrl,serverName,centralServer,casServerName,uriFilterPattern,uriExclusionFilter,authenticateOnlyIfLoggedInFilterPattern,casServerLoginUrlPrefix,gateway,casServerUrlPrefix,contextPath

see jasig cas client for full list of keys/properties supported.

If you wish to turn off CAS add this to .properties file:

disableCAS=true