Search in sources :

Example 1 with SecureEndpointConfiguration

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

the class OauthPasswordAuthenticationProvider method getTokenEndpoint.

/**
 * Builds the secure endpoint from the client configuration.
 *
 * @param clientConfiguration The client configuration
 * @return The token endpoint
 */
protected SecureEndpoint getTokenEndpoint(OauthClientConfiguration clientConfiguration) {
    SecureEndpointConfiguration endpointConfiguration = clientConfiguration.getToken().orElseThrow(() -> new IllegalArgumentException("Token endpoint configuration is missing for provider [" + clientConfiguration.getName() + "]"));
    List<AuthenticationMethod> authMethodsSupported = Collections.singletonList(endpointConfiguration.getAuthMethod().orElse(AuthenticationMethod.CLIENT_SECRET_BASIC));
    String url = endpointConfiguration.getUrl().orElseThrow(() -> new IllegalArgumentException("Token endpoint URL is null for provider [" + clientConfiguration.getName() + "]"));
    return new DefaultSecureEndpoint(url, authMethodsSupported);
}
Also used : SecureEndpointConfiguration(io.micronaut.security.oauth2.configuration.endpoints.SecureEndpointConfiguration) DefaultSecureEndpoint(io.micronaut.security.oauth2.endpoint.DefaultSecureEndpoint) AuthenticationMethod(io.micronaut.security.oauth2.endpoint.AuthenticationMethod)

Aggregations

SecureEndpointConfiguration (io.micronaut.security.oauth2.configuration.endpoints.SecureEndpointConfiguration)1 AuthenticationMethod (io.micronaut.security.oauth2.endpoint.AuthenticationMethod)1 DefaultSecureEndpoint (io.micronaut.security.oauth2.endpoint.DefaultSecureEndpoint)1