[jboss-user] [EJB 3.0] - Re: unable to find LoginModule class
JPagera
do-not-reply at jboss.com
Thu Oct 11 18:42:46 EDT 2007
thankx 4 reply
first i use JBoss 4.0.5 and im using EJB3 and no security restrictions on any EJB method
lokk this is my code ...
....................
String securityDomain = "JPassivateSecurityDomain";
CallbackHandler callbackHandler =
new JPageraCallbackHandler("name","pass");
try
{
LoginContext lc =
new LoginContext( securityDomain,
callbackHandler );
lc.login();
System.out.println("Subject : "+lc.getSubject());
Set seta_ = lc.getSubject().getPrincipals();
}
catch ( LoginException e )
{
e.printStackTrace();
}
...................................
look this code is working perfect .. but the problem is how can i get
the EJB session??
is there anyway to get The initialContext from logincontext??
cuz when im tryin to lookup in the teaditional way
.....................
Properties pro = new Properties();
pro.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
pro.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
pro.put(Context.PROVIDER_URL,"jnp://jpagera:1099");
pro.put(Context.SECURITY_PRINCIPAL,"name");
pro.put(Context.SECURITY_CREDENTIALS,"pass");
pro.put("java.security.auth.login.config","auth.conf");
return new InitialContext(pro);
...............................
it gave Exception
..........
javax.ejb.EJBAccessException: Authentication failure
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSe
curityException(Ejb3AuthenticationInterceptor.java:70)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:70)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:102)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:263)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
java:58)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
roxy.java:102)
at $Proxy100.findAllUserTab(Unknown Source)
......................
thankx 4 u
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094305#4094305
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094305
More information about the jboss-user
mailing list