Search in sources :

Example 1 with SAMLTokenProcessor

use of org.apache.wss4j.dom.processor.SAMLTokenProcessor in project ddf by codice.

the class StsIssueTest method processToken.

/**
     * Method to validate the retrieved token.
     */
private List<WSSecurityEngineResult> processToken(SecurityToken token) throws WSSecurityException {
    RequestData requestData = new RequestData();
    WSSConfig wssConfig = WSSConfig.getNewInstance();
    requestData.setWssConfig(wssConfig);
    /*DDF-733
        CallbackHandler callbackHandler = new CommonCallbackHandler();
        requestData.setCallbackHandler(callbackHandler);
        */
    Crypto crypto = CryptoFactory.getInstance("serverKeystore.properties");
    requestData.setDecCrypto(crypto);
    requestData.setSigVerCrypto(crypto);
    Processor processor = new SAMLTokenProcessor();
    return processor.handleToken(token.getToken(), requestData, new WSDocInfo(token.getToken().getOwnerDocument()));
}
Also used : WSDocInfo(org.apache.wss4j.dom.WSDocInfo) Crypto(org.apache.wss4j.common.crypto.Crypto) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor) Processor(org.apache.wss4j.dom.processor.Processor) WSSConfig(org.apache.wss4j.dom.engine.WSSConfig) RequestData(org.apache.wss4j.dom.handler.RequestData) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor)

Example 2 with SAMLTokenProcessor

use of org.apache.wss4j.dom.processor.SAMLTokenProcessor in project cxf by apache.

the class IssueUnitTest method processToken.

private List<WSSecurityEngineResult> processToken(SecurityToken token) throws Exception {
    RequestData requestData = new RequestData();
    requestData.setDisableBSPEnforcement(true);
    CallbackHandler callbackHandler = new org.apache.cxf.systest.sts.common.CommonCallbackHandler();
    requestData.setCallbackHandler(callbackHandler);
    Crypto crypto = CryptoFactory.getInstance("serviceKeystore.properties");
    requestData.setDecCrypto(crypto);
    requestData.setSigVerCrypto(crypto);
    requestData.setWsDocInfo(new WSDocInfo(token.getToken().getOwnerDocument()));
    Processor processor = new SAMLTokenProcessor();
    return processor.handleToken(token.getToken(), requestData);
}
Also used : WSDocInfo(org.apache.wss4j.dom.WSDocInfo) CommonCallbackHandler(org.apache.cxf.systest.sts.common.CommonCallbackHandler) CallbackHandler(javax.security.auth.callback.CallbackHandler) Crypto(org.apache.wss4j.common.crypto.Crypto) CommonCallbackHandler(org.apache.cxf.systest.sts.common.CommonCallbackHandler) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor) Processor(org.apache.wss4j.dom.processor.Processor) RequestData(org.apache.wss4j.dom.handler.RequestData) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor)

Example 3 with SAMLTokenProcessor

use of org.apache.wss4j.dom.processor.SAMLTokenProcessor in project cxf by apache.

the class STSRESTTest method processToken.

private static List<WSSecurityEngineResult> processToken(Element assertionElement) throws Exception {
    RequestData requestData = new RequestData();
    // requestData.setDisableBSPEnforcement(true);
    requestData.setCallbackHandler(new org.apache.cxf.systest.sts.common.CommonCallbackHandler());
    requestData.setDecCrypto(serviceCrypto);
    // requestData.setSigVerCrypto(serviceCrypto);
    requestData.setWsDocInfo(new WSDocInfo(assertionElement.getOwnerDocument()));
    return new SAMLTokenProcessor().handleToken(assertionElement, requestData);
}
Also used : WSDocInfo(org.apache.wss4j.dom.WSDocInfo) RequestData(org.apache.wss4j.dom.handler.RequestData) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor)

Example 4 with SAMLTokenProcessor

use of org.apache.wss4j.dom.processor.SAMLTokenProcessor in project cxf by apache.

the class SamlTokenInterceptor method processToken.

private List<WSSecurityEngineResult> processToken(Element tokenElement, final SoapMessage message) throws WSSecurityException {
    RequestData data = new CXFRequestData();
    Object o = SecurityUtils.getSecurityPropertyValue(SecurityConstants.CALLBACK_HANDLER, message);
    try {
        data.setCallbackHandler(SecurityUtils.getCallbackHandler(o));
    } catch (Exception ex) {
        throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex);
    }
    data.setMsgContext(message);
    data.setWssConfig(WSSConfig.getNewInstance());
    data.setSigVerCrypto(getCrypto(SecurityConstants.SIGNATURE_CRYPTO, SecurityConstants.SIGNATURE_PROPERTIES, message));
    WSDocInfo wsDocInfo = new WSDocInfo(tokenElement.getOwnerDocument());
    data.setWsDocInfo(wsDocInfo);
    SAMLTokenProcessor p = new SAMLTokenProcessor();
    return p.handleToken(tokenElement, data);
}
Also used : WSDocInfo(org.apache.wss4j.dom.WSDocInfo) RequestData(org.apache.wss4j.dom.handler.RequestData) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor) WSSecurityException(org.apache.wss4j.common.ext.WSSecurityException) WSSecurityException(org.apache.wss4j.common.ext.WSSecurityException)

Example 5 with SAMLTokenProcessor

use of org.apache.wss4j.dom.processor.SAMLTokenProcessor in project cxf by apache.

the class STSUnitTest method processToken.

private List<WSSecurityEngineResult> processToken(SecurityToken token) throws Exception {
    RequestData requestData = new RequestData();
    CallbackHandler callbackHandler = new CommonCallbackHandler();
    requestData.setCallbackHandler(callbackHandler);
    Crypto crypto = CryptoFactory.getInstance("clientKeystore.properties", this.getClass().getClassLoader());
    requestData.setSigVerCrypto(crypto);
    requestData.setWsDocInfo(new WSDocInfo(token.getToken().getOwnerDocument()));
    Processor processor = new SAMLTokenProcessor();
    return processor.handleToken(token.getToken(), requestData);
}
Also used : WSDocInfo(org.apache.wss4j.dom.WSDocInfo) CallbackHandler(javax.security.auth.callback.CallbackHandler) Crypto(org.apache.wss4j.common.crypto.Crypto) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor) Processor(org.apache.wss4j.dom.processor.Processor) RequestData(org.apache.wss4j.dom.handler.RequestData) SAMLTokenProcessor(org.apache.wss4j.dom.processor.SAMLTokenProcessor)

Aggregations

WSDocInfo (org.apache.wss4j.dom.WSDocInfo)6 RequestData (org.apache.wss4j.dom.handler.RequestData)6 SAMLTokenProcessor (org.apache.wss4j.dom.processor.SAMLTokenProcessor)6 Crypto (org.apache.wss4j.common.crypto.Crypto)4 Processor (org.apache.wss4j.dom.processor.Processor)4 CallbackHandler (javax.security.auth.callback.CallbackHandler)3 CommonCallbackHandler (org.apache.cxf.systest.sts.common.CommonCallbackHandler)1 WSSecurityException (org.apache.wss4j.common.ext.WSSecurityException)1 WSSConfig (org.apache.wss4j.dom.engine.WSSConfig)1