Search in sources :

Example 1 with Google2Client

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

the class Pac4jAuthenticationEventExecutionPlanConfiguration method configureGoogleClient.

private void configureGoogleClient(final Collection<BaseClient> properties) {
    final Pac4jProperties.Google google = casProperties.getAuthn().getPac4j().getGoogle();
    final Google2Client client = new Google2Client(google.getId(), google.getSecret());
    if (StringUtils.isNotBlank(google.getId()) && StringUtils.isNotBlank(google.getSecret())) {
        if (StringUtils.isNotBlank(google.getScope())) {
            client.setScope(Google2Client.Google2Scope.valueOf(google.getScope().toUpperCase()));
        }
        properties.add(client);
    }
}
Also used : Pac4jProperties(org.apereo.cas.configuration.model.support.pac4j.Pac4jProperties) Google2Client(org.pac4j.oauth.client.Google2Client)

Example 2 with Google2Client

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

the class DelegatedClientFactory method configureGoogleClient.

/**
 * Configure google client.
 *
 * @param properties the properties
 */
protected void configureGoogleClient(final Collection<BaseClient> properties) {
    final Pac4jDelegatedAuthenticationProperties.Google google = pac4jProperties.getGoogle();
    final Google2Client client = new Google2Client(google.getId(), google.getSecret());
    if (StringUtils.isNotBlank(google.getId()) && StringUtils.isNotBlank(google.getSecret())) {
        configureClient(client, google);
        if (StringUtils.isNotBlank(google.getScope())) {
            client.setScope(Google2Client.Google2Scope.valueOf(google.getScope().toUpperCase()));
        }
        LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey());
        properties.add(client);
    }
}
Also used : Pac4jDelegatedAuthenticationProperties(org.apereo.cas.configuration.model.support.pac4j.Pac4jDelegatedAuthenticationProperties) Google2Client(org.pac4j.oauth.client.Google2Client)

Example 3 with Google2Client

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

the class RunGoogle2Client method getClient.

@Override
protected IndirectClient getClient() {
    final Google2Client google2Client = new Google2Client();
    google2Client.setKey("682158564078-ndcjc83kp5v7vudikqu1fudtkcs2odeb.apps.googleusercontent.com");
    google2Client.setSecret("gLB2U7LPYBFTxqYtyG81AhLH");
    google2Client.setCallbackUrl(PAC4J_BASE_URL);
    google2Client.setScope(Google2Client.Google2Scope.EMAIL_AND_PROFILE);
    return google2Client;
}
Also used : Google2Client(org.pac4j.oauth.client.Google2Client)

Example 4 with Google2Client

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

the class DefaultDelegatedClientFactory method configureGoogleClient.

/**
 * Configure google client.
 *
 * @param properties the properties
 */
protected void configureGoogleClient(final Collection<IndirectClient> properties) {
    val pac4jProperties = casProperties.getAuthn().getPac4j();
    val google = pac4jProperties.getGoogle();
    if (google.isEnabled() && StringUtils.isNotBlank(google.getId()) && StringUtils.isNotBlank(google.getSecret())) {
        val client = new Google2Client(google.getId(), google.getSecret());
        configureClient(client, google);
        if (StringUtils.isNotBlank(google.getScope())) {
            client.setScope(Google2Client.Google2Scope.valueOf(google.getScope().toUpperCase()));
        }
        LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey());
        properties.add(client);
    }
}
Also used : lombok.val(lombok.val) Google2Client(org.pac4j.oauth.client.Google2Client)

Aggregations

Google2Client (org.pac4j.oauth.client.Google2Client)4 lombok.val (lombok.val)1 Pac4jDelegatedAuthenticationProperties (org.apereo.cas.configuration.model.support.pac4j.Pac4jDelegatedAuthenticationProperties)1 Pac4jProperties (org.apereo.cas.configuration.model.support.pac4j.Pac4jProperties)1