[jboss-user] [Security & JAAS/JBoss] - Re: Webapp Auth/Auth with Custom LoginModule Principals
ppareit
do-not-reply at jboss.com
Mon Aug 14 07:32:23 EDT 2006
I have the same problem:
I use the following realm code:
| if (!subject.getPrincipals().contains(userPrincipal))
| subject.getPrincipals().add(userPrincipal);
| subject.getPrincipals().addAll(rolePrincipals);
|
Where userPrinipal an instance of UserPrincipal (Framework class), and RolePrincipals is ArrayList (Framework class).
In my application I use the following code:
| locale = (Locale) principal.getClass().getMethod("getLocale",(Class[]) null).invoke(principal, (Object[]) null);
|
| dateFormat = (String) principal.getClass().getMethod("getDateFormat", (Class[]) null).invoke(principal,(Object[]) null);
|
On a Tomcat 5.5 server everything works fine.
On Jboss 4.0.4 GA: I get the following exception:
| java.lang.NoSuchMethodException: org.jboss.security.SimplePrincipal.getLocale()
| at java.lang.Class.getMethod(Class.java:1581)
| at com.easypaygroup.framework.control.userprofile.UserProfile.<init>(UserProfile.java:70)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
| at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
| at java.lang.Class.newInstance0(Class.java:350)
| at java.lang.Class.newInstance(Class.java:303)
| at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:274)
| at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:265)
| at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:50)
| at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311)
| at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
| at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:574)
| at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
| at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
| at org.apache.myfaces.taglib.core.ViewTag.setProperties(ViewTag.java:199)
| at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:536)
| at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:312)
| at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:70)
| at org.apache.jsp.com.easypaygroup.easytest.webapp.menu.menu_jsp._jspService(menu_jsp.java:64)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
|
| ............
|
| java.lang.IllegalArgumentException: Locale or String class expected. Expression: #{UserProfile.locale}. Return value nul
| l
| at org.apache.myfaces.taglib.core.ViewTag.setProperties(ViewTag.java:218)
| at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:536)
| at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:312)
| at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:70)
| at org.apache.jsp.com.easypaygroup.easytest.webapp.menu.menu_jsp._jspService(menu_jsp.java:64)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
| at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
| at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
| at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
| at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
| at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:367)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at com.easypaygroup.framework.hibernate.CloseSessionFilter.doFilter(CloseSessionFilter.java:28)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
| :664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964934#3964934
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964934
More information about the jboss-user
mailing list