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