Search in sources :

Example 6 with ClientCredential

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());
    });
}
Also used : ClientCredential(org.apereo.cas.authentication.principal.ClientCredential)

Example 7 with ClientCredential

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);
}
Also used : ClientCredential(org.apereo.cas.authentication.principal.ClientCredential) ServletExternalContext(org.springframework.webflow.context.servlet.ServletExternalContext) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) FacebookClient(org.pac4j.oauth.client.FacebookClient) OAuth20Credentials(org.pac4j.oauth.credentials.OAuth20Credentials) Clients(org.pac4j.core.client.Clients) OAuth20Credentials(org.pac4j.oauth.credentials.OAuth20Credentials) Credentials(org.pac4j.core.credentials.Credentials) MockServletContext(org.springframework.mock.web.MockServletContext) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Before(org.junit.Before)

Aggregations

ClientCredential (org.apereo.cas.authentication.principal.ClientCredential)7 Credentials (org.pac4j.core.credentials.Credentials)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 AuthenticationResult (org.apereo.cas.authentication.AuthenticationResult)2 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)2 WebContext (org.pac4j.core.context.WebContext)2 UserProfile (org.pac4j.core.profile.UserProfile)2 GeneralSecurityException (java.security.GeneralSecurityException)1 FailedLoginException (javax.security.auth.login.FailedLoginException)1 HttpSession (javax.servlet.http.HttpSession)1 NonNull (lombok.NonNull)1 CentralAuthenticationService (org.apereo.cas.CentralAuthenticationService)1 PreventedException (org.apereo.cas.authentication.PreventedException)1 Service (org.apereo.cas.authentication.principal.Service)1 WebApplicationService (org.apereo.cas.authentication.principal.WebApplicationService)1 Before (org.junit.Before)1 BaseClient (org.pac4j.core.client.BaseClient)1 Client (org.pac4j.core.client.Client)1 Clients (org.pac4j.core.client.Clients)1