Search in sources :

Example 1 with ClaimsCallback

use of org.apache.cxf.ws.security.trust.claims.ClaimsCallback in project cxf by apache.

the class ClaimsCallbackHandler method handle.

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
    for (int i = 0; i < callbacks.length; i++) {
        if (callbacks[i] instanceof ClaimsCallback) {
            ClaimsCallback callback = (ClaimsCallback) callbacks[i];
            callback.setClaims(createClaims());
        } else {
            throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
        }
    }
}
Also used : ClaimsCallback(org.apache.cxf.ws.security.trust.claims.ClaimsCallback) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException)

Example 2 with ClaimsCallback

use of org.apache.cxf.ws.security.trust.claims.ClaimsCallback in project cxf by apache.

the class AbstractSTSClient method addClaims.

protected void addClaims(XMLStreamWriter writer) throws Exception {
    Object claimsToSerialize = claims;
    if (claimsToSerialize == null && claimsCallbackHandler != null) {
        ClaimsCallback callback = new ClaimsCallback(message);
        claimsCallbackHandler.handle(new Callback[] { callback });
        claimsToSerialize = callback.getClaims();
    }
    if (claimsToSerialize instanceof Element) {
        StaxUtils.copy((Element) claimsToSerialize, writer);
    } else if (claimsToSerialize instanceof ClaimCollection) {
        ClaimCollection claimCollection = (ClaimCollection) claims;
        claimCollection.serialize(writer, "wst", namespace);
    }
}
Also used : ClaimsCallback(org.apache.cxf.ws.security.trust.claims.ClaimsCallback) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Element(org.w3c.dom.Element) ClaimCollection(org.apache.cxf.rt.security.claims.ClaimCollection)

Aggregations

ClaimsCallback (org.apache.cxf.ws.security.trust.claims.ClaimsCallback)2 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)1 ClaimCollection (org.apache.cxf.rt.security.claims.ClaimCollection)1 Element (org.w3c.dom.Element)1