public String getKeyIdentifierValueType() { if (containsKeyIdentifier()) { Element elem = getFirstElement(); return elem.getAttributeNS(null, "ValueType"); } return null; }
public String getKeyIdentifierEncodingType() { if (containsKeyIdentifier()) { Element elem = getFirstElement(); return elem.getAttributeNS(null, "EncodingType"); } return null; }
private REFERENCE_TYPE getReferenceType(SecurityTokenReference secRef) { if (secRef.containsReference()) { return REFERENCE_TYPE.DIRECT_REF; } else if (secRef.containsKeyIdentifier()) { if (SecurityTokenReference.THUMB_URI.equals(secRef.getKeyIdentifierValueType())) { return REFERENCE_TYPE.THUMBPRINT_SHA1; } else { return REFERENCE_TYPE.KEY_IDENTIFIER; } } return null; } }
private REFERENCE_TYPE getReferenceType(SecurityTokenReference secRef) { if (secRef.containsReference()) { return REFERENCE_TYPE.DIRECT_REF; } else if (secRef.containsKeyIdentifier()) { if (SecurityTokenReference.THUMB_URI.equals(secRef.getKeyIdentifierValueType())) { return REFERENCE_TYPE.THUMBPRINT_SHA1; } else { return REFERENCE_TYPE.KEY_IDENTIFIER; } } return null; }
public String getKeyIdentifierValue() { if (containsKeyIdentifier()) { return XMLUtils.getElementText(getFirstElement()); } return null; }
/** * Check that the EncryptedKey referenced by the SecurityTokenReference argument * is BSP compliant. * @param secRef The SecurityTokenReference to the BinarySecurityToken * @param bspEnforcer a BSPEnforcer instance to enforce BSP rules * @throws WSSecurityException */ public static void checkEncryptedKeyBSPCompliance( SecurityTokenReference secRef, BSPEnforcer bspEnforcer ) throws WSSecurityException { if (secRef.containsKeyIdentifier()) { String valueType = secRef.getKeyIdentifierValueType(); if (!SecurityTokenReference.ENC_KEY_SHA1_URI.equals(valueType)) { bspEnforcer.handleBSPRule(BSPRule.R3063); } } String tokenType = secRef.getTokenType(); if (!WSConstants.WSS_ENC_KEY_VALUE_TYPE.equals(tokenType)) { bspEnforcer.handleBSPRule(BSPRule.R5215); } }
bspEnforcer.handleBSPRule(BSPRule.R3058); } else if (secRef.containsKeyIdentifier()) { String valueType = secRef.getKeyIdentifierValueType(); if (!SecurityTokenReference.SKI_URI.equals(valueType)
) throws WSSecurityException { if (secRef.containsKeyIdentifier()) { String valueType = secRef.getKeyIdentifierValueType(); if (samlAssertion.getSaml1() != null
} else if (secRef.containsKeyIdentifier()) {
} else if (secRef.containsKeyIdentifier()) { String valueType = secRef.getKeyIdentifierValueType(); if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(valueType)
parserResult.setCerts(new X509Certificate[]{foundCerts[0]}); } else if (secRef.containsKeyIdentifier()) { if (secRef.getKeyIdentifierValueType().equals(SecurityTokenReference.ENC_KEY_SHA1_URI)) { STRParserUtil.checkEncryptedKeyBSPCompliance(secRef, data.getBSPEnforcer());
Crypto crypto = data.getDecCrypto(); if (secRef.containsKeyIdentifier()) { if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(secRef.getKeyIdentifierValueType()) || WSConstants.WSS_SAML2_KI_VALUE_TYPE.equals(secRef.getKeyIdentifierValueType())) {
} else if (secRef.containsKeyIdentifier()) { String keyIdentifierValueType = secRef.getKeyIdentifierValueType(); if (WSConstants.WSS_KRB_KI_VALUE_TYPE.equals(keyIdentifierValueType)) {
/** * Parse a SecurityTokenReference element and extract credentials. * * @param parameters The parameters to parse * @return the STRParserResult Object containing the parsing results * @throws WSSecurityException */ public STRParserResult parseSecurityTokenReference(STRParserParameters parameters) throws WSSecurityException { if (parameters == null || parameters.getData() == null || parameters.getData().getWsDocInfo() == null || parameters.getStrElement() == null) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, "invalidSTRParserParameter" ); } SecurityTokenReference secRef = new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer()); String uri = null; if (secRef.getReference() != null) { uri = secRef.getReference().getURI(); uri = XMLUtils.getIDFromReference(uri); } else if (secRef.containsKeyIdentifier()) { uri = secRef.getKeyIdentifierValue(); } WSSecurityEngineResult result = parameters.getData().getWsDocInfo().getResult(uri); if (result != null) { return processPreviousResult(result, secRef, parameters); } return processSTR(secRef, uri, parameters); }
uri = secRef.getReference().getURI(); uri = XMLUtils.getIDFromReference(uri); } else if (secRef.containsKeyIdentifier()) { uri = secRef.getKeyIdentifierValue();
/** * Parse a SecurityTokenReference element and extract credentials. * * @param parameters The parameters to parse * @return the STRParserResult Object containing the parsing results * @throws WSSecurityException */ public STRParserResult parseSecurityTokenReference(STRParserParameters parameters) throws WSSecurityException { if (parameters == null || parameters.getData() == null || parameters.getData().getWsDocInfo() == null || parameters.getStrElement() == null) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, "invalidSTRParserParameter" ); } SecurityTokenReference secRef = new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer()); String uri = null; if (secRef.getReference() != null) { uri = secRef.getReference().getURI(); uri = XMLUtils.getIDFromReference(uri); } else if (secRef.containsKeyIdentifier()) { uri = secRef.getKeyIdentifierValue(); } WSSecurityEngineResult result = parameters.getData().getWsDocInfo().getResult(uri); if (result != null) { return processPreviousResult(result, secRef, parameters); } return processSTR(secRef, parameters); }
/** * Parse a SecurityTokenReference element and extract credentials. * * @param parameters The parameters to parse * @return the STRParserResult Object containing the parsing results * @throws WSSecurityException */ public STRParserResult parseSecurityTokenReference(STRParserParameters parameters) throws WSSecurityException { if (parameters == null || parameters.getData() == null || parameters.getData().getWsDocInfo() == null || parameters.getStrElement() == null) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, "invalidSTRParserParameter" ); } SecurityTokenReference secRef = new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer()); String uri = null; if (secRef.getReference() != null) { uri = secRef.getReference().getURI(); uri = XMLUtils.getIDFromReference(uri); } else if (secRef.containsKeyIdentifier()) { uri = secRef.getKeyIdentifierValue(); } WSSecurityEngineResult result = parameters.getData().getWsDocInfo().getResult(uri); if (result != null) { return processPreviousResult(result, secRef, uri, parameters); } return processSTR(secRef, uri, parameters); }