Search in sources :

Example 1 with EndSessionEndpointConfiguration

use of io.micronaut.security.oauth2.configuration.endpoints.EndSessionEndpointConfiguration in project micronaut-security by micronaut-projects.

the class OpenIdClientFactory method overrideFromConfig.

private void overrideFromConfig(DefaultOpenIdProviderMetadata configuration, OpenIdClientConfiguration openIdClientConfiguration, OauthClientConfiguration oauthClientConfiguration) {
    openIdClientConfiguration.getJwksUri().ifPresent(configuration::setJwksUri);
    oauthClientConfiguration.getIntrospection().ifPresent(introspection -> {
        introspection.getUrl().ifPresent(configuration::setIntrospectionEndpoint);
        introspection.getAuthMethod().ifPresent(authMethod -> configuration.setIntrospectionEndpointAuthMethodsSupported(Collections.singletonList(authMethod.toString())));
    });
    oauthClientConfiguration.getRevocation().ifPresent(revocation -> {
        revocation.getUrl().ifPresent(configuration::setRevocationEndpoint);
        revocation.getAuthMethod().ifPresent(authMethod -> configuration.setRevocationEndpointAuthMethodsSupported(Collections.singletonList(authMethod.toString())));
    });
    openIdClientConfiguration.getRegistration().flatMap(EndpointConfiguration::getUrl).ifPresent(configuration::setRegistrationEndpoint);
    openIdClientConfiguration.getUserInfo().flatMap(EndpointConfiguration::getUrl).ifPresent(configuration::setUserinfoEndpoint);
    openIdClientConfiguration.getAuthorization().flatMap(EndpointConfiguration::getUrl).ifPresent(configuration::setAuthorizationEndpoint);
    openIdClientConfiguration.getToken().ifPresent(token -> {
        token.getUrl().ifPresent(configuration::setTokenEndpoint);
        token.getAuthMethod().ifPresent(authMethod -> configuration.setTokenEndpointAuthMethodsSupported(Collections.singletonList(authMethod.toString())));
    });
    EndSessionEndpointConfiguration endSession = openIdClientConfiguration.getEndSession();
    if (endSession.isEnabled()) {
        endSession.getUrl().ifPresent(configuration::setEndSessionEndpoint);
    }
}
Also used : EndSessionEndpointConfiguration(io.micronaut.security.oauth2.configuration.endpoints.EndSessionEndpointConfiguration)

Aggregations

EndSessionEndpointConfiguration (io.micronaut.security.oauth2.configuration.endpoints.EndSessionEndpointConfiguration)1