use of org.apereo.cas.authentication.credential.BasicIdentifiableCredential in project cas by apereo.
the class AbstractOAuth20Tests method getAuthentication.
protected static Authentication getAuthentication(final Principal principal) {
val metadata = new BasicCredentialMetaData(new BasicIdentifiableCredential(principal.getId()));
val handlerResult = new DefaultAuthenticationHandlerExecutionResult(principal.getClass().getCanonicalName(), metadata, principal, new ArrayList<>());
return DefaultAuthenticationBuilder.newInstance().setPrincipal(principal).setAuthenticationDate(ZonedDateTime.now(ZoneOffset.UTC)).addCredential(metadata).addSuccess(principal.getClass().getCanonicalName(), handlerResult).build();
}
use of org.apereo.cas.authentication.credential.BasicIdentifiableCredential in project cas by apereo.
the class PasswordlessCasWebflowLoginContextProviderTests method verifyOperation.
@Test
public void verifyOperation() {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
RequestContextHolder.setRequestContext(context);
ExternalContextHolder.setExternalContext(context.getExternalContext());
val account = new BasicIdentifiableCredential();
account.setId(UUID.randomUUID().toString());
WebUtils.putPasswordlessAuthenticationAccount(context, account);
val results = passwordlessCasWebflowLoginContextProvider.getCandidateUsername(context);
assertFalse(results.isEmpty());
assertEquals(account.getId(), results.get());
}
Aggregations