use of org.apereo.cas.authentication.principal.ClientCredential in project cas by apereo.
the class ClientAuthenticationMetaDataPopulator method populateAttributes.
@Override
public void populateAttributes(final AuthenticationBuilder builder, final AuthenticationTransaction transaction) {
transaction.getPrimaryCredential().ifPresent(clientCredential -> {
final ClientCredential credentials = ClientCredential.class.cast(clientCredential);
builder.addAttribute(ClientCredential.AUTHENTICATION_ATTRIBUTE_CLIENT_NAME, credentials.getClientName());
});
}
use of org.apereo.cas.authentication.principal.ClientCredential in project cas by apereo.
the class ClientAuthenticationHandlerTests method setUp.
@Before
public void setUp() {
this.fbClient = new FacebookClient();
final Clients clients = new Clients(CALLBACK_URL, fbClient);
this.handler = new ClientAuthenticationHandler("", mock(ServicesManager.class), null, clients);
this.handler.setTypedIdUsed(true);
final Credentials credentials = new OAuth20Credentials(null);
this.clientCredential = new ClientCredential(credentials, fbClient.getName());
final ServletExternalContext mock = new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse());
ExternalContextHolder.setExternalContext(mock);
}
Aggregations