Skip to end of metadata
Go to start of metadata
Table of Contents

New CAS documentation site

Icon

CAS documentation has moved over to apereo.github.io/cas, starting with CAS version 4.x. The wiki will no longer be maintained. For the most recent version of the documentation, please refer to the aforementioned link.

JAAS Authentication Handler

Briefly, JAAS is a standard API provided by Java 1.4 and higher which provides PAM-like authentication and authorization. An external file is used to configure JAAS. Using JAAS with CAS allows modification of the authentication process without having to rebuild and redeploy CAS, and allows for PAM-style multi-module "stacked" authentication.

Core Classes

JaasAuthenticationHandler

The JaasAuthenticationHandler is a hook into the Java Authentication and Authorization Service and delegates all authentication to the underlying runtime and its configured JAAS file. Therefore it only has one property:

  • realm - the realm within the JAAS configuration file we are going to use. Defaults to CAS.

Configuration

Like other handlers, the JAAS Authentication Handler is simply configured in the deployerConfigContext.xml. Within the AuthenticationManager's "authenticationHandlers" property, place the following configuration (replacing the example Test handler):

Example jaas.conf File

Below, you'll find an example jaas.conf file which would contain your JAAS configuration information.

The path to the JAAS Configuration file is specified for this JVM as a system property, i.e. -Djava.security.auth.login.config=jaas.conf , or a default can be specified for an entire Java Runtime Environment by changing the {jre-home}/lib/security/java.security properties file to add a "Default login configuration file" under the property "login.config.url.1=file:..." (find the comment example in the current file).

If you enable the Krb5LoginModule and authenticate the userid and password against a Kerberos KDC, then Java must be told the name of the Kerberos Realm and the network name of the KDC. Again, this can be done with system properties (java.security.krb5.realm and java.security.krb5.kdc) or by copying a Unix krb5.conf file into the {jre-home}/lib/security directory. Note that SPNEGO also uses Kerberos and sets the same system properties. So if you are planning to use both JAAS and SPNEGO with Kerberos, read about SPNEGO configuration when planning JAAS.

NOTE

If using jre 1.6, you will need to use "com.sun.security.auth.module.Krb5LoginModule sufficient" for Kerberos V5 to work correctly.

  • No labels