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");
}
}
}
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);
}
}
Aggregations