[jboss-dev-forums] [JBoss ESB Development] - ClassCastException in CertificateLoginModule

h.wolffenbuttel do-not-reply at jboss.com
Wed Oct 7 06:45:15 EDT 2009


While implementing JAAS security into my JBossESB i stumbled on a ClassCastException in the CertificateLoginModule. While debugging i found the code where the problem occurs:


  |  private X509Certificate getCallerCertificate(final ObjectCallback objectCallback) throws LoginException
  |     {
  |         final Set<?> credentials = (Set<?>) objectCallback.getCredential();
  |         if (credentials == null || credentials.isEmpty())
  |         {
  |             throw new LoginException("No X509Certificate was passed to the login module");
  |         }
  | 
  |         X509Certificate callerCert = null;
  |         for (Object object : credentials)
  |         {
  |             if (object instanceof X509Certificate)
  |             {
  |                 callerCert = (X509Certificate) object;
  |                 break;
  |             }
  |         }
  | 
  |         if (callerCert == null)
  |         {
  |             throw new LoginException("No X509Certificate was passed to the login module");
  |         }
  | 
  |         return callerCert;
  |     }
  | 

The problem is that objectCallback.getCredential() contains an ObjectArray of X509Certificate and not a Set<?>. So this explains the ClassCastException. 

Is it a configuration problem or just a bug? 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4259104#4259104

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4259104



More information about the jboss-dev-forums mailing list