...
Create a module properties file named CASCASAMLoginModule.xml.
Compile and packaging cas.am.CASAMLoginModule and cas.am.CASAMPrincipal into CASAMLoginModule.jar. The codes are attached at the bottom of this page.
...
Copy casclient.jar to <AM_BASE_DIR>/web-src/services/WEB-INF/lib.
Copy CASCASAMLoginModule.xml to <AM_BASE_DIR>/web-src/services/config/auth/default.
...
*Tips: for development purpose, you can put the jars and xml into amserver.war directly and redeploy it as a normal web application on your web container. The directory structure is as follows:
amserver.war\WEB-INF\lib\CASAMLoginModule.jar
amserver.war\WEB-INF\lib\casclient.jar
amserver.war\config\auth\default\CASCASAMLoginModule.xml
Configuring Access Manager
...
Enter URL http://<host>.<domain>:<port>/amserver/UI/Login?module=CASCASAMLoginModule&goto=http://<host>.<domain>:<port>/portal/dt. (If you choose to use an organization other than the default, please specify that in the URL using the 'org' parameter.)
...
Code Block |
---|
package cas.am; import javax.security.auth.*; import javax.security.auth.login.*; import javax.security.auth.callback.*; import java.security.Principal; public class CASAMPrincipal implements Principal, java.io.Serializable { /** * @serial */ private String name; public CASAMPrincipal(String name) { if (name == null) throw new NullPointerException("illegal null input"); this.name = name; } /** * Return the username for this <code>CASAMPrincipal</code>. * * <p> * * @return the username for this <code>CASAMPrincipal</code> */ public String getName() { return name; } /** * Return a string representation of this <code>CASAMPrincipal</code>. * * <p> * * @return a string representation of this <code>CASAMPrincipal</code>. */ public String toString() { return("CASAMPrincipal: " + name); } /** * Compares the specified Object with this <code>CASAMPrincipal</code> * for equality. Returns true if the given object is also a * <code>CASAMPrincipal</code> and the two CASAMPrincipals * have the same username. * * <p> * * @param o Object to be compared for equality with this * <code>CASAMPrincipal</code>. * * @return true if the specified Object is equal equal to this * <code>CASAMPrincipal</code>. */ public boolean equals(Object o) { if (o == null) return false; if (this == o) return true; if (!(o instanceof CASAMPrincipal)) return false; CASAMPrincipal that = (CASAMPrincipal)o; if (this.getName().equals(that.getName())) return true; return false; } /** * Return a hash code for this <code>CASAMPrincipal</code>. * * <p> * * @return a hash code for this <code>CASAMPrincipal</code>. */ public int hashCode() { return name.hashCode(); } } |
...
CASAMLoginModule.xml
Code Block |
---|
<?xml version='1.0' encoding="UTF-8"?> <!DOCTYPE ModuleProperties PUBLIC "=//iPlanet//Authentication Module Properties XML Interface 1.0 DTD//EN" "jar://com/sun/identity/authentication/Auth_Module_Properties.dtd"> <ModuleProperties moduleName="CASCASAMLoginModule" version="1.0" > </ModuleProperties> |