public Validator getValidator(QName qName) throws WSSecurityException { String key = validatorKeys.get(qName); if (key != null && this.getMsgContext() != null) { Object o = ((SoapMessage)this.getMsgContext()).getContextualProperty(key); try { if (o instanceof Validator) { return (Validator)o; } else if (o instanceof Class) { return (Validator)((Class<?>)o).newInstance(); } else if (o instanceof String) { return (Validator)ClassLoaderUtils.loadClass(o.toString(), CXFRequestData.class) .newInstance(); } else if (o != null) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "Cannot load Validator: " + o); } } catch (RuntimeException t) { throw t; } catch (Exception ex) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex); } } return super.getValidator(qName); } }
public Validator getValidator(QName qName) throws WSSecurityException { String key = validatorKeys.get(qName); if (key != null && this.getMsgContext() != null) { Object o = ((SoapMessage)this.getMsgContext()).getContextualProperty(key); try { if (o instanceof Validator) { return (Validator)o; } else if (o instanceof Class) { return (Validator)((Class<?>)o).newInstance(); } else if (o instanceof String) { return (Validator)ClassLoaderUtils.loadClass(o.toString(), CXFRequestData.class) .newInstance(); } else if (o != null) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "Cannot load Validator: " + o); } } catch (RuntimeException t) { throw t; } catch (Exception ex) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex); } } return super.getValidator(qName); } }
public List<WSSecurityEngineResult> handleToken( Element elem, RequestData data ) throws WSSecurityException { LOG.debug("Found Timestamp list element"); // // Decode Timestamp, add the found time (created/expiry) to result // Timestamp timestamp = new Timestamp(elem, data.getBSPEnforcer()); Credential credential = new Credential(); credential.setTimestamp(timestamp); WSSecurityEngineResult result = new WSSecurityEngineResult(WSConstants.TS, timestamp); String tokenId = timestamp.getID(); if (!"".equals(tokenId)) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); } Validator validator = data.getValidator(WSConstants.TIMESTAMP); if (validator != null) { validator.validate(credential, data); result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE); } data.getWsDocInfo().addTokenElement(elem); data.getWsDocInfo().addResult(result); return java.util.Collections.singletonList(result); }
data.getValidator(new QName(elem.getNamespaceURI(), elem.getLocalName()));
data.getValidator(new QName(elem.getNamespaceURI(), elem.getLocalName()));
Validator validator = data.getValidator(new QName(elem.getNamespaceURI(), elem.getLocalName()));
Validator validator = data.getValidator(WSConstants.SIGNATURE); if (keyInfoElement == null) { certs = getDefaultCerts(data.getSigVerCrypto());
Validator validator = data.getValidator(WSConstants.USERNAME_TOKEN); Credential credential = handleUsernameToken(elem, validator, data); UsernameToken token = credential.getUsernametoken();