I write the logmodule class, configuration class, Action class, client class
and my policy file my.policy.
I add the VM parameter when I start weblogic server
"-Djava.security.auth.policy=D:\bea\wlserver6.1/lib/my.policy"
But I don't know how to let weblogic server know my configuration class, so
that the server will create it when my client code create LoginContext
object.
Some artical told me that add the configuration class name in java.security
file, like the following
login.configuration.provider=mypackage.myConfig
unfortunately, it don't work :(
I always got the exception message
No Configuration Class Name Supplied
Does anyone kindly tell me how to let the system know my configuration class
name?
Regards,
xlzhou
// Set configuration class name to load SampleConfiguration, the
//Configuration for the JAAS code example
property = new Properties(System.getProperties());
property.put("weblogic.security.jaas.Configuration",
"test.servlets.TestConfig");
System.setProperties(property);
// Set Configuration file name to load sample configuration policy
file.
property = new Properties(System.getProperties());
property.put("weblogic.security.jaas.Policy",
"C:/bea/wlserver6.1/config/mydomain/Test.policy");
System.setProperties(property);
loginContext = new LoginContext("TestPolicy", new
MyCallbackHandler());
The Test.policy:
TestPolicy
{
test.servlets.TestLoginModule required debug=true;
};
And I add "-Djava.security.auth.policy=%WL_HOME%\config\mydomain\Test.policy"
when I start weblogic server.
But when I run the code, I got the exception:
Invalid Configuration Class Name: test.servlets.TestConfig
java.lang.NullPointerException
at javax.security.auth.login.LoginContext.loadLoginModule(LoginContext.j
ava:101)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:54)
at test.servlets.TestSecure.doPost(TestSecure.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2456)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Seems the problem is in my TestConfig.
I just copy the SampleConfig.java as my TestConfig.java (modified a
little) and copy the ConfigParser.java (those are in the
samples\examples\security\jaas\examples\security\jaas)
Any suggestion???
BTW, all the necessary classes is in the .war file.
Thanks in advance.
Joe
"Xiao Ling Zhou" <zhou...@hotmail.com> wrote in message news:<3c5668f1$1...@newsgroups.bea.com>...
I was getting this error ("No Configuration Class Name Supplied") until I
1. added the login config and auth policy params to the command line:
-Djava.security.auth.login.config==.../jdk131/jre/lib/security/tagish.login
-Djava.security.auth.policy==.../jdk131/jre/lib/security/struts.policy
2. added the jaas jar to the lib/ext directory
.../jdk131/jre/lib/ext/jaas.jar
I don't know how to replace the default sun configuration class
(com.sun.security.auth.login.ConfigFile) because weblogic seems to
ignore the .../jdk131/jre/lib/security/java.security file, and the JAAS
documentation explicitly states (from
http://java.sun.com/j2se/1.4/docs/guide/security/jaas/JAASRefGuide.html):
"The default JAAS login configuration implementation can be replaced by
specifying the alternative provider class implementation in the
login.configuration.provider property.
For example:
login.configuration.provider=com.foo.Config
If the Security property login.configuration.provider is not found, or
is left unspecified, then it is set to the default value:
login.configuration.provider=com.sun.security.auth.login.ConfigFile
Note that there is no means to dynamically set the login configuration
provider from the command line. "
Dan