public void prepare(Document doc, Crypto crypto) throws WSSecurityException, ConversationException { if (sct == null) { if (identifier != null) { sct = new SecurityContextToken(wscVersion, doc, identifier); } else { sct = new SecurityContextToken(wscVersion, doc); identifier = sct.getIdentifier(); } } // The wsu:Id of the wsc:SecurityContextToken if (sctId != null) { sct.setID(sctId); } }
/** * @return Returns the sctId. */ public String getSctId() { if (sct != null) { return sct.getID(); } return sctId; }
@Override public boolean equals(Object object) { if (!(object instanceof SecurityContextToken)) { return false; } SecurityContextToken securityToken = (SecurityContextToken)object; if (!compare(getIdentifier(), securityToken.getIdentifier())) { return false; } return true; }
new SecurityContextToken(this.getWSCVersion(data.getTokenType()), doc); TrustUtil.createRequestedSecurityTokenElement(wstVersion, rstrElem); rstElem.addChild((OMElement) sct.getElement()); reqAttachedRef = TrustUtil.createRequestedAttachedRef(wstVersion, rstrElem, "#" + sct.getID(), tokenType); reqUnattachedRef = TrustUtil.createRequestedUnattachedRef(wstVersion, rstrElem, sct.getIdentifier(), tokenType); Token sctToken = new Token(sct.getIdentifier(), (OMElement) sct.getElement(), creationTime, expirationTime);
WSDocInfo wsDocInfo ) throws WSSecurityException { SecurityContextToken sct = new SecurityContextToken(elem); String tokenId = sct.getID(); if (!"".equals(tokenId)) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); String id = sct.getID(); if (id.charAt(0) == '#') { id = id.substring(1); secret = getSecret(data.getCallbackHandler(), sct.getIdentifier()); } catch (WSSecurityException ex) { secret = getSecret(data.getCallbackHandler(), id); secret = getSecret(data.getCallbackHandler(), id); result.put(WSSecurityEngineResult.TAG_ID, sct.getID()); result.put(WSSecurityEngineResult.TAG_SECRET, secret);
OMElement bodyElem = msgCtx.getEnvelope().getBody(); OMElement child = bodyElem.getFirstElement(); SecurityContextToken sct = new SecurityContextToken( (Element) rmd.getTokenStorage().getToken(tokenId) .getToken()); OMElement newChild = TrustUtil.createCancelRequest(sct .getIdentifier(), rmd.getWstVersion()); Element newDomChild = XMLUtils.toDOM(newChild); Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
@Override public int hashCode() { int result = 17; String identifier = getIdentifier(); if (identifier != null) { result = 31 * result + identifier.hashCode(); } return result; }
public void prependSCTElementToHeader(Document doc, WSSecHeader secHeader) throws WSSecurityException { WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), sct.getElement()); }
/** * Constructor to create the SCT * * @param doc */ public SecurityContextToken(int version, Document doc) throws ConversationException { String ns = ConversationConstants.getWSCNs(version); element = doc.createElementNS(ns, "wsc:" + ConversationConstants.SECURITY_CONTEXT_TOKEN_LN); WSSecurityUtil.setNamespace(element, ns, ConversationConstants.WSC_PREFIX); elementIdentifier = doc.createElementNS(ns, "wsc:" + ConversationConstants.IDENTIFIER_LN); element.appendChild(elementIdentifier); String uuid = "uuid:" + UUIDGenerator.getUUID(); elementIdentifier.appendChild(doc.createTextNode(uuid)); setID(getWSSConfig().getIdAllocator().createSecureId("sctId-", element)); }
/** * Get the identifier. * * @return the data from the identifier element. */ public String getIdentifier() { if (elementIdentifier != null) { return getFirstNode(elementIdentifier).getData(); } return null; }
WSDocInfo wsDocInfo ) throws WSSecurityException { SecurityContextToken sct = new SecurityContextToken(elem); String tokenId = sct.getID(); if (!"".equals(tokenId)) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); String id = sct.getID(); if (id.charAt(0) == '#') { id = id.substring(1); secret = getSecret(data.getCallbackHandler(), sct.getIdentifier()); } catch (WSSecurityException ex) { secret = getSecret(data.getCallbackHandler(), id); secret = getSecret(data.getCallbackHandler(), id); result.put(WSSecurityEngineResult.TAG_ID, sct.getID()); result.put(WSSecurityEngineResult.TAG_SECRET, secret);
@Override public int hashCode() { int result = 17; String identifier = getIdentifier(); if (identifier != null) { result = 31 * result + identifier.hashCode(); } return result; }
public void prependSCTElementToHeader(Document doc, WSSecHeader secHeader) throws WSSecurityException { WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), sct.getElement()); }
/** * Constructor to create the SCT * * @param doc */ public SecurityContextToken(int version, Document doc) throws ConversationException { String ns = ConversationConstants.getWSCNs(version); element = doc.createElementNS(ns, "wsc:" + ConversationConstants.SECURITY_CONTEXT_TOKEN_LN); WSSecurityUtil.setNamespace(element, ns, ConversationConstants.WSC_PREFIX); elementIdentifier = doc.createElementNS(ns, "wsc:" + ConversationConstants.IDENTIFIER_LN); element.appendChild(elementIdentifier); String uuid = "uuid:" + UUIDGenerator.getUUID(); elementIdentifier.appendChild(doc.createTextNode(uuid)); setID(getWSSConfig().getIdAllocator().createSecureId("sctId-", element)); }
/** * Get the identifier. * * @return the data from the identifier element. */ public String getIdentifier() { if (elementIdentifier != null) { return getFirstNode(elementIdentifier).getData(); } return null; }
public void prepare(Document doc, Crypto crypto) throws WSSecurityException, ConversationException { if (sct == null) { if (identifier != null) { sct = new SecurityContextToken(wscVersion, doc, identifier); } else { sct = new SecurityContextToken(wscVersion, doc); identifier = sct.getIdentifier(); } } // The wsu:Id of the wsc:SecurityContextToken if (sctId != null) { sct.setID(sctId); } }
@Override public boolean equals(Object object) { if (!(object instanceof SecurityContextToken)) { return false; } SecurityContextToken securityToken = (SecurityContextToken)object; if (!compare(getIdentifier(), securityToken.getIdentifier())) { return false; } return true; }
WSSecurityEngineResult.TAG_SECURITY_CONTEXT_TOKEN ); principal = new CustomTokenPrincipal(sct.getIdentifier()); } else if (WSConstants.DKT == action) { DerivedKeyToken dkt =
/** * @return Returns the sctId. */ public String getSctId() { if (sct != null) { return sct.getID(); } return sctId; }
public WSSecurityEngineResult(int act, SecurityContextToken sct) { put(TAG_ACTION, Integer.valueOf(act)); put(TAG_SECURITY_CONTEXT_TOKEN, sct); put(TAG_VALIDATED_TOKEN, Boolean.FALSE); put(TAG_TOKEN_ELEMENT, sct.getElement()); }