/** * 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, bspEnforcer); } return null; }
new SecurityTokenReference( (Element)securityTokenReference, requestData.getBSPEnforcer()
private SecurityToken findCancelOrRenewToken(Exchange exchange, Element el) throws WSSecurityException { Element childElement = DOMUtils.getFirstElement(el); String uri = ""; if ("SecurityContextToken".equals(childElement.getLocalName())) { SecurityContextToken sct = new SecurityContextToken(childElement); uri = sct.getIdentifier(); } else { SecurityTokenReference ref = new SecurityTokenReference(childElement, new BSPEnforcer()); uri = ref.getReference().getURI(); } TokenStore store = (TokenStore)exchange.getEndpoint().getEndpointInfo() .getProperty(TokenStore.class.getName()); return store.getToken(uri); }
private SecurityToken findCancelOrRenewToken(Exchange exchange, Element el) throws WSSecurityException { Element childElement = DOMUtils.getFirstElement(el); String uri = ""; if ("SecurityContextToken".equals(childElement.getLocalName())) { SecurityContextToken sct = new SecurityContextToken(childElement); uri = sct.getIdentifier(); } else { SecurityTokenReference ref = new SecurityTokenReference(childElement, new BSPEnforcer()); uri = ref.getReference().getURI(); } TokenStore store = (TokenStore)exchange.getEndpoint().getEndpointInfo() .getProperty(TokenStore.class.getName()); return store.getToken(uri); }
boolean useDirectReferenceToAssertion ) { SecurityTokenReference secRefSaml = new SecurityTokenReference(doc); String secRefID = wssConfig.getIdAllocator().createSecureId("STR-", secRefSaml); secRefSaml.setID(secRefID);
boolean useDirectReferenceToAssertion ) { SecurityTokenReference secRefSaml = new SecurityTokenReference(doc); String secRefID = wssConfig.getIdAllocator().createSecureId("STR-", secRefSaml); secRefSaml.setID(secRefID);
Element writeSecurityTokenReference( W3CDOMStreamWriter writer, String id, String refValueType ) { Reference ref = new Reference(writer.getDocument()); ref.setURI(id); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(writer.getDocument()); str.addWSSENamespace(); str.setReference(ref); writer.getCurrentNode().appendChild(str.getElement()); return str.getElement(); }
Element writeSecurityTokenReference( W3CDOMStreamWriter writer, String id, String refValueType ) { Reference ref = new Reference(writer.getDocument()); ref.setURI(id); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(writer.getDocument()); str.addWSSENamespace(); str.setReference(ref); writer.getCurrentNode().appendChild(str.getElement()); return str.getElement(); }
Element writeSecurityTokenReference( W3CDOMStreamWriter writer, String id, String instance, String refValueType ) { Reference ref = new Reference(writer.getDocument()); ref.setURI(id); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(writer.getDocument()); str.addWSSENamespace(); str.setReference(ref); if (instance != null) { try { Element firstChildElement = str.getFirstElement(); if (firstChildElement != null) { int version = NegotiationUtils.getWSCVersion(refValueType); String ns = ConversationConstants.getWSCNs(version); firstChildElement.setAttributeNS(ns, "wsc:" + ConversationConstants.INSTANCE_LN, instance); } } catch (WSSecurityException e) { //just return without wsc:Instance } } writer.getCurrentNode().appendChild(str.getElement()); return str.getElement(); }
Element writeSecurityTokenReference( W3CDOMStreamWriter writer, String id, String instance, String refValueType ) { Reference ref = new Reference(writer.getDocument()); ref.setURI(id); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(writer.getDocument()); str.addWSSENamespace(); str.setReference(ref); if (instance != null) { try { Element firstChildElement = str.getFirstElement(); if (firstChildElement != null) { int version = NegotiationUtils.getWSCVersion(refValueType); String ns = ConversationConstants.getWSCNs(version); firstChildElement.setAttributeNS(ns, "wsc:" + ConversationConstants.INSTANCE_LN, instance); } } catch (WSSecurityException e) { //just return without wsc:Instance } } writer.getCurrentNode().appendChild(str.getElement()); return str.getElement(); }
/** * Create a KeyInfo object * @throws ConversationException */ private KeyInfo createKeyInfo() throws WSSecurityException { KeyInfo keyInfo = new KeyInfo(getDocument()); SecurityTokenReference secToken = new SecurityTokenReference(getDocument()); secToken.addWSSENamespace(); Reference ref = new Reference(getDocument()); ref.setURI("#" + getId()); 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; }
secRef = new SecurityTokenReference(getDocument()); strUri = getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);
/** * 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); }
/** * 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); }
SecurityTokenReference tokenRef = new SecurityTokenReference(saaj.getSOAPPart()); String tokenType = encrTok.getTokenType(); if (encrToken instanceof KerberosToken) {
new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer());
new SecurityTokenReference(cloneElement(ref), new BSPEnforcer()); sig.setSecurityTokenReference(secRef); sig.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
= new SecurityTokenReference(doc); if (tok.getSHA1() != null) { tokenRef.setKeyIdentifierEncKeySHA1(tok.getSHA1());
= new SecurityTokenReference(doc); if (tok.getSHA1() != null) { tokenRef.setKeyIdentifierEncKeySHA1(tok.getSHA1());