use of org.apereo.cas.authentication.RememberMeCredential in project cas by apereo.
the class SurrogateInitialAuthenticationAction method convertToSurrogateCredential.
private void convertToSurrogateCredential(final RequestContext context, final UsernamePasswordCredential up) {
final SurrogateUsernamePasswordCredential sc = new SurrogateUsernamePasswordCredential();
final String tUsername = up.getUsername();
final String surrogateUsername = tUsername.substring(0, tUsername.indexOf(this.separator));
final String realUsername = tUsername.substring(tUsername.indexOf(this.separator) + 1);
if (StringUtils.isBlank(surrogateUsername)) {
up.setUsername(realUsername);
context.getFlowScope().put(SurrogateWebflowEventResolver.CONTEXT_ATTRIBUTE_REQUEST_SURROGATE, Boolean.TRUE);
WebUtils.putCredential(context, up);
return;
}
sc.setUsername(realUsername);
sc.setSurrogateUsername(surrogateUsername);
sc.setPassword(up.getPassword());
if (up instanceof RememberMeCredential) {
sc.setRememberMe(((RememberMeCredential) up).isRememberMe());
}
context.getFlowScope().put(SurrogateWebflowEventResolver.CONTEXT_ATTRIBUTE_REQUEST_SURROGATE, Boolean.FALSE);
WebUtils.putCredential(context, sc);
}
use of org.apereo.cas.authentication.RememberMeCredential in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulator method populateAttributes.
@Override
public void populateAttributes(final AuthenticationBuilder builder, final Credential credential) {
final RememberMeCredential r = (RememberMeCredential) credential;
if (r.isRememberMe()) {
LOGGER.debug("Credential is configured to be remembered. Captured this as [{}] attribute", RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
builder.addAttribute(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, Boolean.TRUE);
}
}
Aggregations