Search in sources :

Example 1 with JsonHttpClient

use of org.dcache.gplazma.oidc.helpers.JsonHttpClient in project dcache by dCache.

the class OidcAuthPlugin method buildProcessor.

private static TokenProcessor buildProcessor(Properties properties) {
    Duration discoveryCacheDuration = asDuration(properties, DISCOVERY_CACHE_REFRESH);
    JsonHttpClient client = buildClientFromProperties(properties);
    Set<IdentityProvider> providers = new HashSet<>();
    providers.addAll(buildHosts(properties, client.getClient(), discoveryCacheDuration));
    providers.addAll(buildProviders(properties, client.getClient(), discoveryCacheDuration));
    checkArgument(!providers.isEmpty(), "No OIDC providers configured");
    var queryUserInfo = new QueryUserInfoEndpoint(properties, client, providers);
    var offlineVerification = new OfflineJwtVerification(properties, client.getClient(), providers);
    return ChainedTokenProcessor.tryWith(offlineVerification).andThenTryWith(queryUserInfo);
}
Also used : OfflineJwtVerification(org.dcache.gplazma.oidc.jwt.OfflineJwtVerification) Duration(java.time.Duration) PropertiesUtils.asDuration(org.dcache.gplazma.oidc.PropertiesUtils.asDuration) QueryUserInfoEndpoint(org.dcache.gplazma.oidc.userinfo.QueryUserInfoEndpoint) JsonHttpClient(org.dcache.gplazma.oidc.helpers.JsonHttpClient) HashSet(java.util.HashSet)

Aggregations

Duration (java.time.Duration)1 HashSet (java.util.HashSet)1 PropertiesUtils.asDuration (org.dcache.gplazma.oidc.PropertiesUtils.asDuration)1 JsonHttpClient (org.dcache.gplazma.oidc.helpers.JsonHttpClient)1 OfflineJwtVerification (org.dcache.gplazma.oidc.jwt.OfflineJwtVerification)1 QueryUserInfoEndpoint (org.dcache.gplazma.oidc.userinfo.QueryUserInfoEndpoint)1