-
1. Re: JBossSecurityMgrRealm
didi1976 Apr 11, 2003 9:37 AM (in response to didi1976)Hi,
could somebody please change the method in the following way so the login module gets called:
public Principal authenticate(X509Certificate[] certs)
{
SimplePrincipal principal = null;
Context securityCtx = getSecurityContext();
if( securityCtx == null )
{
return null;
}
try
{
// Get the JBoss security manager from the ENC context
AuthenticationManager securityMgr = (AuthenticationManager) securityCtx.lookup("securityMgr");
principal = new SimplePrincipal(certs[0].getSerialNumber() + " " + certs[0].getIssuerDN());
if( securityMgr.isValid(principal, certs) )
{
category.log(XLevel.TRACE, "User: "+principal+" is authenticated");
SecurityAssociation.setPrincipal(principal);
SecurityAssociation.setCredential(certs);
}
else
{
category.log(XLevel.TRACE, "User: "+principal+" is NOT authenticated");
principal = null;
}
}
catch(NamingException e)
{
category.error("Error during authenticate", e);
}
return principal;
}
Did not do a lot of tests till now due to a lack of time but this should fix it for the moment.
Thanks,
Didi