/** * Returns the SecurityTokenReference of the derived key token * * @return the Security Token Reference of the derived key token * @throws WSSecurityException */ public SecurityTokenReference getSecurityTokenReference() throws WSSecurityException { if (elementSecurityTokenReference != null) { return new SecurityTokenReference(elementSecurityTokenReference, bspCompliant); } return null; }
/** * Returns the SecurityTokenReference of the derived key token * * @return the Security Token Reference of the derived key token * @throws WSSecurityException */ public SecurityTokenReference getSecurityTokenReference() throws WSSecurityException { if (elementSecurityTokenReference != null) { return new SecurityTokenReference(elementSecurityTokenReference, bspCompliant); } return null; }
new SecurityTokenReference( (Element)securityTokenReference, wssConfig.isWsiBSPCompliant()
new SecurityTokenReference( (Element)securityTokenReference, wssConfig.isWsiBSPCompliant()
SecurityTokenReference secRef = new SecurityTokenReference(str);
/** * Create a wsse:Reference element with the given URI and the value type * * @param doc * @param refUri * @param refValueType * @return Element */ public static Element createSecurityTokenReference(Document doc, String refUri, String refValueType) { Reference ref = new Reference(doc); ref.setURI(refUri); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(doc); str.setReference(ref); return str.getElement(); }
private void processValidateTarget()throws TrustException{ OMElement validateTargetElem = this.rstElement .getFirstChildWithName(new QName(this.wstNs, RahasConstants.LocalNames.VALIDATE_TARGET)); if (validateTargetElem != null) { OMElement strElem = validateTargetElem.getFirstChildWithName(new QName(WSConstants.WSSE_NS, "SecurityTokenReference")); Element elem = (Element)OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory(), strElem.getXMLStreamReader()).getDocumentElement(); try { SecurityTokenReference str = new SecurityTokenReference((Element)elem); if (str.containsReference()) { tokenId = str.getReference().getURI(); } else if(str.containsKeyIdentifier()){ tokenId = str.getKeyIdentifierValue(); } } catch (WSSecurityException e) { throw new TrustException("errorExtractingTokenId",e); } } }
/** * Create a KeyInfo object * @throws ConversationException */ private KeyInfo createKeyInfo() throws WSSecurityException, ConversationException { KeyInfo keyInfo = new KeyInfo(document); SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); Reference ref = new Reference(document); ref.setURI("#" + dktId); String ns = ConversationConstants.getWSCNs(getWscVersion()) + ConversationConstants.TOKEN_TYPE_DERIVED_KEY_TOKEN; ref.setValueType(ns); secToken.setReference(ref); keyInfo.addUnknownElement(secToken.getElement()); Element keyInfoElement = keyInfo.getElement(); keyInfoElement.setAttributeNS( WSConstants.XMLNS_NS, "xmlns:" + WSConstants.SIG_PREFIX, WSConstants.SIG_NS ); return keyInfo; }
keyInfo.addUnknownElement(getEncryptedKeyElement()); } else if (keyIdentifierType == WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); if (customReferenceValue != null) { keyInfo.addKeyName(embeddedKeyName == null ? user : embeddedKeyName); } else if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(customReferenceValue)) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); secToken.addTokenType(WSConstants.WSS_SAML_TOKEN_TYPE); keyInfo.addUnknownElement(secToken.getElement()); } else if (WSConstants.WSS_SAML2_KI_VALUE_TYPE.equals(customReferenceValue)) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); secToken.addTokenType(WSConstants.WSS_SAML2_TOKEN_TYPE); keyInfo.addUnknownElement(secToken.getElement()); } else if (WSConstants.WSS_KRB_KI_VALUE_TYPE.equals(customReferenceValue)) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); secToken.addTokenType(WSConstants.WSS_GSS_KRB_V5_AP_REQ); keyInfo.addUnknownElement(securityTokenReference.getElement()); } else if (encKeyId != null) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); Reference ref = new Reference(document);
SecurityTokenReference secRef = new SecurityTokenReference(strElement, bspCompliant);
keyInfo.addUnknownElement(getEncryptedKeyElement()); } else if (keyIdentifierType == WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); if (customReferenceValue != null) { keyInfo.addKeyName(embeddedKeyName == null ? user : embeddedKeyName); } else if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(customReferenceValue)) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); secToken.addTokenType(WSConstants.WSS_SAML_TOKEN_TYPE); keyInfo.addUnknownElement(secToken.getElement()); } else if (WSConstants.WSS_SAML2_KI_VALUE_TYPE.equals(customReferenceValue)) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); secToken.addTokenType(WSConstants.WSS_SAML2_TOKEN_TYPE); keyInfo.addUnknownElement(secToken.getElement()); } else if (WSConstants.WSS_KRB_KI_VALUE_TYPE.equals(customReferenceValue)) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); secToken.addTokenType(WSConstants.WSS_GSS_KRB_V5_AP_REQ); keyInfo.addUnknownElement(securityTokenReference.getElement()); } else if (encKeyId != null) { SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); Reference ref = new Reference(document);
SecurityTokenReference secRef = new SecurityTokenReference(strElement, bspCompliant);
/** * Create a KeyInfo object * @throws ConversationException */ private KeyInfo createKeyInfo() throws WSSecurityException, ConversationException { KeyInfo keyInfo = new KeyInfo(document); SecurityTokenReference secToken = new SecurityTokenReference(document); secToken.addWSSENamespace(); Reference ref = new Reference(document); ref.setURI("#" + dktId); String ns = ConversationConstants.getWSCNs(getWscVersion()) + ConversationConstants.TOKEN_TYPE_DERIVED_KEY_TOKEN; ref.setValueType(ns); secToken.setReference(ref); keyInfo.addUnknownElement(secToken.getElement()); Element keyInfoElement = keyInfo.getElement(); keyInfoElement.setAttributeNS( WSConstants.XMLNS_NS, "xmlns:" + WSConstants.SIG_PREFIX, WSConstants.SIG_NS ); return keyInfo; }
SecurityTokenReference str = new SecurityTokenReference((Element)elem); if (str.containsReference()) { tokenId = str.getReference().getURI();
SecurityTokenReference secRef = new SecurityTokenReference(document); String strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);
SecurityTokenReference secRef = new SecurityTokenReference(document); String strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);
SecurityTokenReference secRef = new SecurityTokenReference(strElement, bspCompliant);
SecurityTokenReference secRef = new SecurityTokenReference(strElement, bspCompliant);
secRef = new SecurityTokenReference(doc); strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);
secRef = new SecurityTokenReference(doc); strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);