Search in sources :

Example 1 with ProcessingException

use of org.apache.cxf.fediz.core.exception.ProcessingException in project cas by apereo.

the class DefaultRelyingPartyTokenProducer method requestSecurityTokenResponse.

@SneakyThrows
private Element requestSecurityTokenResponse(final WSFederationRegisteredService service, final SecurityTokenServiceClient sts, final Assertion assertion) {
    try {
        val properties = sts.getProperties();
        properties.put(SecurityConstants.USERNAME, assertion.getPrincipal().getName());
        val uid = credentialCipherExecutor.encode(assertion.getPrincipal().getName());
        properties.put(SecurityConstants.PASSWORD, uid);
        return sts.requestSecurityTokenResponse(service.getAppliesTo());
    } catch (final SoapFault ex) {
        if (ex.getFaultCode() != null && "RequestFailed".equals(ex.getFaultCode().getLocalPart())) {
            throw new IllegalArgumentException(new ProcessingException(ProcessingException.TYPE.BAD_REQUEST));
        }
        LoggingUtils.error(LOGGER, ex);
        throw ex;
    }
}
Also used : lombok.val(lombok.val) SoapFault(org.apache.cxf.binding.soap.SoapFault) ProcessingException(org.apache.cxf.fediz.core.exception.ProcessingException) SneakyThrows(lombok.SneakyThrows)

Aggregations

SneakyThrows (lombok.SneakyThrows)1 lombok.val (lombok.val)1 SoapFault (org.apache.cxf.binding.soap.SoapFault)1 ProcessingException (org.apache.cxf.fediz.core.exception.ProcessingException)1