@Override
public boolean assertToken(TokenSecurityEvent<? extends SecurityToken> tokenSecurityEvent,
AbstractToken abstractToken) throws WSSPolicyException, XMLSecurityException {
if (!(tokenSecurityEvent instanceof X509TokenSecurityEvent)) {
throw new WSSPolicyException("Expected a X509TokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
}
X509Token x509Token = (X509Token) abstractToken;
SecurityToken securityToken = tokenSecurityEvent.getSecurityToken();
WSSecurityTokenConstants.TokenType tokenType = securityToken.getTokenType();
if (!(WSSecurityTokenConstants.X509V3Token.equals(tokenType)
|| WSSecurityTokenConstants.X509V1Token.equals(tokenType)
|| WSSecurityTokenConstants.X509Pkcs7Token.equals(tokenType)
|| WSSecurityTokenConstants.X509PkiPathV1Token.equals(tokenType))) {
throw new WSSPolicyException("Invalid Token for this assertion");
}
try {
X509Certificate x509Certificate = securityToken.getX509Certificates()[0];
if (x509Token.getIssuerName() != null) {