use of org.apereo.cas.authentication.Credential in project cas by apereo.
the class SurrogateSelectionAction method doExecute.
@Override
protected Event doExecute(final RequestContext requestContext) {
final Credential credential = WebUtils.getCredential(requestContext);
if (credential instanceof UsernamePasswordCredential) {
final UsernamePasswordCredential upc = UsernamePasswordCredential.class.cast(credential);
final String target = requestContext.getExternalContext().getRequestParameterMap().get("surrogateTarget");
if (StringUtils.isNotBlank(target)) {
upc.setUsername(target + this.separator + upc.getUsername());
}
}
return success();
}
use of org.apereo.cas.authentication.Credential in project cas by apereo.
the class X509CertificateCredentialsRequestHeaderAction method constructCredentialsFromRequest.
@Override
protected Credential constructCredentialsFromRequest(final RequestContext context) {
final Credential x509Credential = super.constructCredentialsFromRequest(context);
if (x509Credential != null) {
return x509Credential;
}
final X509Certificate[] certFromHeader = x509CertificateExtractor.extract((HttpServletRequest) context.getExternalContext().getNativeRequest());
if (certFromHeader != null) {
LOGGER.debug("Certificate found in HTTP request via {}", x509CertificateExtractor.getClass().getName());
return new X509CertificateCredential(certFromHeader);
}
LOGGER.debug("Certificates not found in request header.");
return null;
}
Aggregations