CauchyPeano commented on issue #2: WSS-659 SecurityContextToken validator 
fixing QName
URL: https://github.com/apache/ws-wss4j/pull/2#issuecomment-572142741
 
 
   Hey @coheigea ,
   
   I am trying to write test now, and have difficulty to understanding how to 
write Validator. Here is what I am trying to do:
   
   ```
               AbstractInboundSecurityToken abstractInboundSecurityToken = new 
AbstractInboundSecurityToken(null, IDGenerator.generateID(null), 
SecurityTokenConstants.KeyIdentifier_KeyValue, true) {
                   @Override
                   public SecurityTokenConstants.TokenType getTokenType() {
                       return WSSecurityTokenConstants.SECURITY_CONTEXT_TOKEN;
                   }
   
                   @Override
                   protected Key getKey(String algorithmURI, 
XMLSecurityConstants.AlgorithmUsage algorithmUsage, String correlationID) 
throws XMLSecurityException {
                       return new SecretKeySpec("test".getBytes(), "sha-256"); 
//I guess this part is wrong
                   }
               };
               SecurityContextTokenValidator validator = new 
SecurityContextTokenValidator() {
                   @Override
                   public InboundSecurityToken 
validate(AbstractSecurityContextTokenType securityContextTokenType, String 
identifier, TokenContext tokenContext) {
                       System.out.println("Test!!");
                       return abstractInboundSecurityToken;
                   }
               };
               securityProperties.addValidator(WSSConstants.TAG_WSC0502_SCT, 
validator);
               securityProperties.addValidator(WSSConstants.TAG_WSC0512_SCT, 
validator);
   ```
   
   In this example I am getting exception at this line: 
`org/apache/santuario/xmlsec/2.1.4/xmlsec-2.1.4-sources.jar!/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureInputHandler.java:354`
   
   What will be the correct way to configure it for tests? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org
For additional commands, e-mail: dev-h...@ws.apache.org

Reply via email to