ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzamy_5.4.0.1/50/sec/seccjaas.htm

81 lines
6.6 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 new feature in WebSphere Application Server - Express. JAAS is a collection of WebSphere Application Server - Express strategic authentication APIs for and replace the CORBA programmatic login APIs. 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 JAAS V1.0, 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><strong>Version 5.0.1 or later:</strong> 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(&quot;Within Subject.doAsPrivileged()&quot;);
Subject s1 = Subject.getSubject(AccessController.getContext());
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
Subject s2 = Subject.getSubject(AccessController.getContext());
return null;
}
}
return null;
}
}</pre></li>
<li>You can configure JAAS login in the WebSphere administrative console. However, WebSphere Application Server - Express still supports the default JAAS login configuration format (plan text file) that is provided by the JAAS default implementation. If there are duplicate login configurations defined in both the administrative configuration and the plan text file format, the one in the configuration takes precedence. There are advantages to defining the login configuration with the administrative console:
<ul>
<li>User interface support in defining JAAS login configuration.</li>
<li>You can manage the JAAS configuration login configuration centrally.</li>
</ul><p></p></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 can not 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><strong>Note:</strong> Do not remove or delete the pre-defined JAAS login configurations (ClientContainer, WSLogin and DefaultPrincipalMapping). Deleting or removing them could cause other enterprise applications to fail.</p>
<p><strong>Create a new JAAS login configuration</strong></p>
<p>Perform these steps in the administrative console:</p>
<ol>
<li>Click <strong>Security</strong> in the navigation tree.</li>
<li>Click <strong>JAAS Configuration --&gt; 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 debug with value true. 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 file 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/WebASE/ASE5/<em>instanceName</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><strong>Note:</strong> Do not remove or delete the pre-defined JAAS login configurations (ClientContainer, WSLogin, system.SWAM and system.LTPA). Deleting or removing them could cause other enterprise applications to fail.</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>