WS-Security : getting commmon name with DirectReference or IssuerSerial method
------------------------------------------------------------------------------
Key: XFIRE-909
URL: http://jira.codehaus.org/browse/XFIRE-909
Project: XFire
Issue Type: Bug
Affects Versions: 1.2.5
Environment: Windows 2000, Tomcat 5.5.20, JDK 1.5.0_07
Reporter: Raphaël Corre
Assigned To: Dan Diephouse
I sign my messages using DirectReference method ; the problem is that i can't
get the certificate's common name using the code below. The same code works
fine if I use IssuerSerial method.
Finally, I have found the solution : in my log, i've seen that my certificate
was expired. What is interesting is that Xfire+WSS4J don't react the same way
if i use DirectReference or IssuerSerial.
public class SecurityHandler extends AbstractHandler {
private static final Log Log = LogFactory.getLog(SecurityHandler.class);
public void invoke(MessageContext context) throws Exception {
try {
Vector result = (Vector)
context.getProperty(WSHandlerConstants.RECV_RESULTS);
if (result != null) {
for (int i = 0; i < result.size(); i++)
{
WSHandlerResult res = (WSHandlerResult)
result.get(i);
for (int j = 0; j < res.getResults().size(); j++)
{
WSSecurityEngineResult secRes =
(WSSecurityEngineResult) res.getResults().get(j);
int action = secRes.getAction();
// SIGNATURE
if( ( action & WSConstants.SIGN ) > 0 ){
//X509Certificate cert =
secRes.getCertificate();
X500Name principal = (X500Name)
secRes.getPrincipal();
// Do something whith cert
Log.info("Signature for : " +
principal.getCommonName());
context.getInMessage().setProperty("net.gicm.astral.commonname",
principal.getCommonName());
}
}
}
}
} catch (Throwable e) {
Log.error("Erreur lors de la récupération du common name du
certificat", e);
}
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email