99 lines
8.5 KiB
HTML
99 lines
8.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
|
|
|
|
<title>Configure Java Authentication and Authorization Service login</title>
|
|
</head>
|
|
|
|
<BODY>
|
|
<!-- Java sync-link -->
|
|
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
|
|
|
<h3><a name="seccjaas">Configure Java Authentication and Authorization Service login</a></h3>
|
|
|
|
<p>Java Authentication and Authorization Service (JAAS) is a collection of authentication APIs for programmatic login. WebSphere Application Server - Express has provided some extensions to JAAS:</p>
|
|
|
|
<ul>
|
|
<li><p><strong>com.ibm.websphere.security.auth.WSSubject</strong>
|
|
<br>Due to a design oversight in the JAAS Version 1.0 specification, javax.security.auth.Subject.getSubject() does not return the subject associated with the thread of execution inside a java.security.AccessController.doPrivileged() code block. This presents an inconsistent behavior that is problematic and causes undesirable effort. The com.ibm.websphere.security.auth.WSSubject API provides a workaround to associate the subject to thread of execution. The com.ibm.websphere.security.auth.WSSubject API extends the JAAS authorization model to J2EE resources.</p>
|
|
|
|
<p>You can retrieve the subjects in a Subject.doAs() block with the Subject.getSubject() call. However, this procedure does not work if there is an AccessController.doPrivileged() call within the Subject.doAs() block. In the following example, s1 is equal to <tt>s</tt>, but s2 is <tt>null</tt>:</p>
|
|
|
|
<pre>Subject.doAs(s, new PrivilegedAction() {
|
|
public Object run() {
|
|
System.out.println("Within Subject.doAsPrivileged()");
|
|
Subject s1 = Subject.getSubject(AccessController.getContext());
|
|
AccessController.doPrivileged(new PrivilegedAction() {
|
|
public Object run() {
|
|
Subject s2 = Subject.getSubject(AccessController.getContext());
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}</pre>
|
|
|
|
<p>The AccessController.doPrivileged() method not only truncates the Subject propagation and reduces the permissions, it does not include the JAAS security policy that is defined for the principals within the Subject object.</p></li>
|
|
|
|
<li><strong>Configuration with the console</strong>
|
|
<br>You can configure JAAS login in the administrative console. However, WebSphere Application Server - Express still supports the default JAAS login configuration format (plain text file) that is provided by the JAAS default implementation. If there are duplicate login configurations defined in both the administrative configuration and the plain text file format, the one in the administrative configuration takes precedence.</li>
|
|
|
|
<li><p><strong>Proxy LoginModule</strong>
|
|
<br>The default JAAS implementation does not use the thread context class loader to load classes. The LoginModule cannot load if the LoginModule class file is not in the application class loader or the Java extension class loader class path. Due to this class loader visibility problem, WebSphere Application Server - Express provides a proxy LoginModule to load JAAS LoginModule using the thread context class loader. You do not need to place the LoginModule implementation on the application class loader or the Java extension class loader classpath with this proxy LoginModule.</p></li>
|
|
</ul>
|
|
|
|
<p>Predefined JAAS login configurations are provided for applications to use. You can view the configurations in the WebSphere administrative console. Expand <strong>Security</strong> --> <strong>JAAS Configuration</strong>, and click <strong>Application Login</strong>. The following JAAS login configurations are available for use:</p>
|
|
|
|
<ul>
|
|
<li><p><strong>WSLogin</strong>
|
|
<br>Defines a login configuration and a LoginModule implementation that applications can use, in general.</p></li>
|
|
|
|
<li><p><strong>DefaultPrincipalMapping</strong>
|
|
<br>Defines a special LoginModule module that is typically used by Java 2 Connector to map an authenticated WebSphere user identity to a set of user authentication data (user ID and password) for the specified back-end enterprise information system. For more information about Java 2 Connector and the DefaultMappingModule module, see <a href="seccj2.htm">Configure Java 2 security</a>.</p></li>
|
|
</ul>
|
|
|
|
<p><strong>Note:</strong> Do not remove or delete the pre-defined JAAS login configurations. Deleting or removing them could cause other enterprise applications to fail.</p>
|
|
|
|
<p>A new JAAS login configuration can be added and modified using the administrative console. An application server restart is required for the changes to take effect at run time.</p>
|
|
|
|
<p>There are several locations within the WebSphere Application - Express Server directory structure where you can place a JAAS login module. The following list provides locations for the JAAS login module in order of recommendation:</p>
|
|
|
|
<ul>
|
|
<li><p><strong>Within an Enterprise Archive (EAR) file for a specific Java 2 Enterprise Edition (J2EE) application.</strong>
|
|
<br>If you place the login module within the EAR file, it is accessible to the specific application only.</p></li>
|
|
|
|
<li><p><strong>In the WebSphere Application Server - Express shared library.</strong>
|
|
<br>If you place the login module in the shared library, you must specify which applications can access the module. For more information on shared libraries, see <a href="../admin/appsvrshlib.htm">Administer shared libraries</a> in the <em>Administration</em> topic.</p></li>
|
|
</ul>
|
|
|
|
<p>Perform these steps in the administrative console to configure a new JAAS login:</p>
|
|
<ol>
|
|
<li>Click <strong>Security</strong> in the navigation tree.</li>
|
|
<li>Click <strong>JAAS Configuration</strong> --> <strong>Application Logins</strong>.</li>
|
|
<li>Click <strong>New</strong>. The Application Login Configuration panel appears.</li>
|
|
<li>Specify the alias name of the new JAAS login configuration and click <strong>Apply</strong>. This is the name of the login configuration that you pass in the javax.security.auth.login.LoginContext for creating a new LoginContext.</li>
|
|
<li>Click <strong>JAAS Login Modules</strong>.</li>
|
|
<li>Click <strong>New</strong>.</li>
|
|
<li>Specify the <strong>Module Classname</strong>. It is recommended that you specify WebSphere Proxy LoginModule because of the limitation of the class loader visibility problem.</li>
|
|
<li>Specify the <strong>LoginModule</strong> implementation as the delegate property of the Proxy LoginModule. The WebSphere Proxy LoginModule classname is com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy.</li>
|
|
<li>Select <strong>Authentication Strategy</strong> from the drop down list and click <strong>Apply</strong>.</li>
|
|
<li>Click <strong>Custom Properties</strong>. This will navigate to the Custom Properties panel for the selected LoginModule.</li>
|
|
<li>Create a new property with the name delegate with the value being the real LoginModule implementation. You can specify other properties like <tt>debug</tt> with value <tt>true</tt>. These properties are passed to the LoginModule as options to initialize() method of the LoginModule.</li>
|
|
<li><p>Click <strong>Save</strong>.</p></li>
|
|
</ol>
|
|
|
|
<p><strong>Change the plain text file</strong></p>
|
|
|
|
<p>WebSphere Application Server - Express supports the default JAAS login configuration format (plain text file) provided by the JAAS default implementation. However, there is no tool provided to edit plain text files in this format. You can define the JAAS login configuration in the plain text file wsjaas.conf (which is located in the <tt>properties</tt> subdirectory of your instance root, for example /QIBM/UserData/WebASE51/ASE/<em>instance</em>/properties), any syntax errors can cause the plain JAAS Login Configuration text file to not parse correctly. This could cause other applications to fail.</p>
|
|
|
|
<p>Java client programs that use JAAS for authentication must be invoked with a JAAS configuration file specified. This configuration file is set in the launchClient script. If the launchClient script is not used to invoke the Java client program, ensure that the appropriate JAAS configuration file is passed to the Java virtual machine with the <tt>-Djava.security.auth.login.config</tt> flag.</p>
|
|
|
|
<p>For more information about editing the plain-text JAAS configuration file, see <a href="http://java.sun.com/security/jaas/doc/api.html" target="_">JAAS 1.0 Developer's Guide</a> <img src="www.gif" width="19" height="15" alt="Link outside Information Center">.</p>
|
|
|
|
<p>Restart the application servers to validate changes to the plain text file.</p>
|
|
|
|
</body>
|
|
</html>
|