Search in sources :

Example 1 with OidcExtractor

use of org.pac4j.oidc.credentials.extractor.OidcExtractor in project pac4j by pac4j.

the class OidcClient method clientInit.

@Override
protected void clientInit() {
    CommonHelper.assertNotNull("configuration", configuration);
    configuration.init();
    defaultRedirectActionBuilder(new OidcRedirectActionBuilder(configuration, this));
    defaultCredentialsExtractor(new OidcExtractor(configuration, this));
    defaultAuthenticator(new OidcAuthenticator(configuration, this));
    defaultProfileCreator(new OidcProfileCreator<>(configuration));
    defaultLogoutActionBuilder(new OidcLogoutActionBuilder<U>(configuration));
}
Also used : OidcExtractor(org.pac4j.oidc.credentials.extractor.OidcExtractor) OidcRedirectActionBuilder(org.pac4j.oidc.redirect.OidcRedirectActionBuilder) OidcAuthenticator(org.pac4j.oidc.credentials.authenticator.OidcAuthenticator)

Example 2 with OidcExtractor

use of org.pac4j.oidc.credentials.extractor.OidcExtractor in project ddf by codice.

the class OidcHandler method getCredentialsFromRequest.

private OidcCredentials getCredentialsFromRequest(OidcClient<OidcConfiguration> oidcClient, JEEContext jeeContext) {
    // Check that the request contains a code, an access token or an id token
    Map<String, String[]> requestParams = jeeContext.getRequestParameters();
    if (!requestParams.containsKey("code") && !requestParams.containsKey("access_token") && !requestParams.containsKey("id_token")) {
        return new OidcCredentials();
    }
    oidcClient.setCallbackUrlResolver(new QueryParameterCallbackUrlResolver());
    OidcExtractor oidcExtractor = new OidcExtractor(oidcClient.getConfiguration(), oidcClient);
    return oidcExtractor.extract(jeeContext).orElse(null);
}
Also used : OidcCredentials(org.pac4j.oidc.credentials.OidcCredentials) OidcExtractor(org.pac4j.oidc.credentials.extractor.OidcExtractor) QueryParameterCallbackUrlResolver(org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver)

Aggregations

OidcExtractor (org.pac4j.oidc.credentials.extractor.OidcExtractor)2 QueryParameterCallbackUrlResolver (org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver)1 OidcCredentials (org.pac4j.oidc.credentials.OidcCredentials)1 OidcAuthenticator (org.pac4j.oidc.credentials.authenticator.OidcAuthenticator)1 OidcRedirectActionBuilder (org.pac4j.oidc.redirect.OidcRedirectActionBuilder)1