0 Replies Latest reply on Jan 6, 2012 8:35 AM by David Chokhonelidze

    JAAS with i18n

    David Chokhonelidze Newbie

      Hello,

       

      I develop web application based on JBoss As 7.1.0.CR1 and use plain jaas to authenticate, it works fine but now i need user to change language during authentication and log in to system, i have added following in my jaas implementation:

       

       

                  NameCallback nameCallback = new NameCallback("username");

                  PasswordCallback passwordCallback = new PasswordCallback("password", false);

                 LanguageCallback langCallback = new LanguageCallback();

                  Callback[] callbacks = new Callback[] { nameCallback, passwordCallback, langCallback };

                  callbackHandler.handle(callbacks);

      and in login.html:

       

       

      <select id="lang" name="j_language"  style="padding-top:3;width:100%" class='login-input'>  

                                              <option value="en">English</option>

                                              <option value="fr">French</option> 

                                          </select>


      During authentication following error raises:

       

       

      PB00008: Unrecognized Callback: javax.security.auth.callback.UnsupportedCallbackException: PB00008: Unrecognized Callback

          at org.jboss.security.auth.callback.JBossCallbackHandler.handleCallBack(JBossCallbackHandler.java:138) [picketbox-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.auth.callback.JBossCallbackHandler.handle(JBossCallbackHandler.java:87) [picketbox-4.0.6.Beta2.jar:4.0.6.Beta2]

          at javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:955) [:1.6.0_27]

          at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_27]

          at javax.security.auth.login.LoginContext$SecureCallbackHandler.handle(LoginContext.java:951) [:1.6.0_27]

          at net.fina.ejb.auth.FinALoginModule.login(FinALoginModule.java:54) [fina-ejb-1.0.0.jar:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_27]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_27]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_27]

          at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [:1.6.0_27]

          at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [:1.6.0_27]

          at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [:1.6.0_27]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:449) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.proceedWithJaasLogin(JBossCachedAuthenticationManager.java:383) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:371) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:160) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.as.web.security.JBossWebRealm.authenticate(JBossWebRealm.java:214) [jboss-as-web-7.1.0.CR1.jar:7.1.0.CR1]

          at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:280) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:381) [jbossweb-7.0.7.Final.jar:]

          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.CR1.jar:7.1.0.CR1]

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.CR1.jar:7.1.0.CR1]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.7.Final.jar:]

          at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.7.Final.jar:]

          at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.7.Final.jar:]

          at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.7.Final.jar:]

          at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]

       

      17:23:27,094 INFO  [net.fina.ejb.auth.FinALoginModule] (http--127.0.0.1-8080-2) Aborting...

      17:23:27,095 ERROR [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http--127.0.0.1-8080-2) Login failure: javax.security.auth.login.LoginException: Login Failure: all modules ignored

          at javax.security.auth.login.LoginContext.invoke(LoginContext.java:921) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [:1.6.0_27]

          at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [:1.6.0_27]

          at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [:1.6.0_27]

          at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [:1.6.0_27]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:449) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.proceedWithJaasLogin(JBossCachedAuthenticationManager.java:383) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:371) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:160) [picketbox-infinispan-4.0.6.Beta2.jar:4.0.6.Beta2]

          at org.jboss.as.web.security.JBossWebRealm.authenticate(JBossWebRealm.java:214) [jboss-as-web-7.1.0.CR1.jar:7.1.0.CR1]

          at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:280) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:381) [jbossweb-7.0.7.Final.jar:]

          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.CR1.jar:7.1.0.CR1]

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.CR1.jar:7.1.0.CR1]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.7.Final.jar:]

          at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.7.Final.jar:]

          at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.7.Final.jar:]

          at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.7.Final.jar:]

          at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]

       

      Language Callback is unrecognized for it , how should i fix it? I need to pass language