Search in sources :

Example 1 with OAuth10Configuration

use of org.pac4j.oauth.config.OAuth10Configuration 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 OAuth10Configuration

use of org.pac4j.oauth.config.OAuth10Configuration in project pac4j by pac4j.

the class RunOAuth10Client method getClient.

@Override
protected IndirectClient getClient() {
    final var config = new OAuth10Configuration();
    config.setKey("bjEt8BMpLwFDqZUvp6");
    config.setSecret("NN6fVXRTcV2qYVejVLZqxBRqHgn3ygD4");
    config.setApi(new BitBucketApi());
    config.setProfileDefinition(new BitbucketProfileDefinition());
    final var 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)

Aggregations

OAuth10Client (org.pac4j.oauth.client.OAuth10Client)2 OAuth10Configuration (org.pac4j.oauth.config.OAuth10Configuration)2 lombok.val (lombok.val)1 Test (org.junit.jupiter.api.Test)1 BitbucketProfileDefinition (org.pac4j.oauth.profile.bitbucket.BitbucketProfileDefinition)1 BitBucketApi (org.pac4j.scribe.builder.api.BitBucketApi)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1