Search in sources :

Example 1 with OAuth10Client

use of org.pac4j.oauth.client.OAuth10Client in project cas by apereo.

the class DefaultDelegatedClientAuthenticationWebflowManagerTests method verifyOAuth1StoreOperation.

@Test
public void verifyOAuth1StoreOperation() throws Exception {
    val config = new OAuth10Configuration();
    config.setKey(UUID.randomUUID().toString());
    config.setSecret(UUID.randomUUID().toString());
    val client = new OAuth10Client();
    client.setConfiguration(config);
    val ticket = delegatedClientAuthenticationWebflowManager.store(context, client);
    assertNotNull(ticketRegistry.getTicket(ticket.getId()));
    val service = delegatedClientAuthenticationWebflowManager.retrieve(requestContext, context, client);
    assertNotNull(service);
    assertNull(ticketRegistry.getTicket(ticket.getId()));
}
Also used : lombok.val(lombok.val) OAuth10Client(org.pac4j.oauth.client.OAuth10Client) OAuth10Configuration(org.pac4j.oauth.config.OAuth10Configuration) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with OAuth10Client

use of org.pac4j.oauth.client.OAuth10Client in project pac4j by pac4j.

the class RunOAuth10Client method getClient.

@Override
protected IndirectClient getClient() {
    final OAuth10Configuration config = new OAuth10Configuration();
    config.setKey("bjEt8BMpLwFDqZUvp6");
    config.setSecret("NN6fVXRTcV2qYVejVLZqxBRqHgn3ygD4");
    config.setApi(new BitBucketApi());
    config.setProfileDefinition(new BitbucketProfileDefinition());
    final OAuth10Client client = new OAuth10Client();
    client.setCallbackUrl(PAC4J_BASE_URL);
    client.setConfiguration(config);
    return client;
}
Also used : BitBucketApi(org.pac4j.scribe.builder.api.BitBucketApi) BitbucketProfileDefinition(org.pac4j.oauth.profile.bitbucket.BitbucketProfileDefinition) OAuth10Client(org.pac4j.oauth.client.OAuth10Client) OAuth10Configuration(org.pac4j.oauth.config.OAuth10Configuration)

Example 3 with OAuth10Client

use of org.pac4j.oauth.client.OAuth10Client in project cas by apereo.

the class DefaultDelegatedClientAuthenticationWebflowManager method store.

@Override
public TransientSessionTicket store(final JEEContext webContext, final Client client) throws Exception {
    val ticket = storeDelegatedClientAuthenticationRequest(webContext);
    rememberSelectedClientIfNecessary(webContext, client);
    if (client instanceof SAML2Client) {
        trackSessionIdForSAML2Client(webContext, ticket, (SAML2Client) client);
    }
    if (client instanceof OAuth20Client) {
        trackSessionIdForOAuth20Client(webContext, (OAuth20Client) client, ticket);
    }
    if (client instanceof OidcClient) {
        trackSessionIdForOidcClient(webContext, (OidcClient) client, ticket);
    }
    if (client instanceof CasClient) {
        trackSessionIdForCasClient(webContext, ticket, (CasClient) client);
    }
    if (client instanceof OAuth10Client) {
        trackSessionIdForOAuth10Client(webContext, ticket);
    }
    return ticket;
}
Also used : lombok.val(lombok.val) OAuth20Client(org.pac4j.oauth.client.OAuth20Client) OAuth10Client(org.pac4j.oauth.client.OAuth10Client) OidcClient(org.pac4j.oidc.client.OidcClient) SAML2Client(org.pac4j.saml.client.SAML2Client) CasClient(org.pac4j.cas.client.CasClient)

Aggregations

OAuth10Client (org.pac4j.oauth.client.OAuth10Client)3 lombok.val (lombok.val)2 OAuth10Configuration (org.pac4j.oauth.config.OAuth10Configuration)2 Test (org.junit.jupiter.api.Test)1 CasClient (org.pac4j.cas.client.CasClient)1 OAuth20Client (org.pac4j.oauth.client.OAuth20Client)1 BitbucketProfileDefinition (org.pac4j.oauth.profile.bitbucket.BitbucketProfileDefinition)1 OidcClient (org.pac4j.oidc.client.OidcClient)1 SAML2Client (org.pac4j.saml.client.SAML2Client)1 BitBucketApi (org.pac4j.scribe.builder.api.BitBucketApi)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1