There are two prerequisites that usually need to be done before CAS authentication can be enabled in UniTime.
Since UniTime 3.5, it is possible to enable CAS authentication in UniTime. First of all, the CAS version of the Spring Security Context (file springSecurityContextCAS.xml) must be used instead of the default context (file springSecurityContext.xml). This can be done by setting the following property as Java system variable, e.g., in Tomcat/conf/catalina.properties
Please note that the above property cannot be set in the UniTime's custom properties because it says which security context configuration XML file is to be loaded in and setting the property in the UniTime's custom properties is too late.
The following custom properties need to be set. These properties are needed during the UniTime startup, so they need to be added in Tomcat/conf/catalina.properties or in a UniTime custom properties file (setting them using the Application Configuration will not do, see UniTime Installation: Customization for more details).
The first two properties are needed to ensure that authentication does not go through the UniTime's default login page. The unitime.cas.url property points to the address of the CAS server and unitime.url points to the address of UniTime. This address is passed to the CAS server (it must be enabled on the CAS side) and the control is returned back to this URL when the user is successfully authenticated.
By default, the CAS user name must match the external id of the user in UniTime for the authenticated user to be successfully associated with the appropriate user roles in UniTime (Timetable Manager, Instructor, Student). It is also possible to pick up a custom CAS attribute containing user's external id and full name.
The above properties contain name of the attribute containing the user's external id (should match the external id of the appropriate student, instructor, or timetable manager) and user's name (optional). The last parameter, if set true, can be used to enable trimming of leading zeroes of the external id.
If CAS does not return external id of the user, a translation class can be plugged in. The following example is using an SQL command to translate user name to external id and back.
The first property enabled id translation (it can be used with or without the id-attribute parameter). The second parameter provides the translation class (any class implementing the ExternalUidTranslation interface capable of translating ids from LDAP type (username) to User type (external id) and back), using the CustomSQLExternalUidTranslation class. This class is using SQL commands that can translate user name to external id (third parameter) and external id to user name (fourth parameter). In these queries, %SCHEMA% is replaced by the schema containing UniTime datanbase (property default_schema, defaults to timetable) and ? is the given user name / external id.
If it is desired to log the user out of CAS right away, the following property needs to be set as follows:
When the above property is set as such, the user is logged out of CAS server once he/she clicks the Logut item in UniTime.