Class GoogleTokenProvider
java.lang.Object
io.helidon.security.providers.google.login.GoogleTokenProvider
- All Implemented Interfaces:
AuthenticationProvider
,OutboundSecurityProvider
,SecurityProvider
public final class GoogleTokenProvider
extends Object
implements AuthenticationProvider, OutboundSecurityProvider
Provider supporting login button from front-end.
This expects the token to be sent in a header.
By default, Authorization header with bearer is expected, e.g.:
Authorization: bearer abcdefg_google_id_token_from_login_button_callback
.
Configure login button as described here:
https://developers.google.com/identity/sign-in/web/sign-in
See google-login example.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Fluent API builder to buildGoogleTokenProvider
instance. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(ProviderRequest providerRequest) Authenticate a request.static GoogleTokenProvider.Builder
builder()
Fluent API builder to buildGoogleTokenProvider
instance.static GoogleTokenProvider
Create an instance from configuration.boolean
isOutboundSupported
(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundConfig) Check if the path to be executed is supported by this security provider.outboundSecurity
(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundEndpointConfig) Creates necessary updates to headers and entity needed for outbound security (e.g.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.helidon.security.spi.SecurityProvider
supportedAnnotations, supportedAttributes, supportedConfigKeys, supportedCustomObjects
-
Method Details
-
create
Create an instance from configuration. Used by Security when configuring this provider from configuration by class name.- Parameters:
config
- Configuration located on the provider's key- Returns:
- Instance configured from the configuration instance
-
builder
Fluent API builder to buildGoogleTokenProvider
instance.- Returns:
- Builder with just default values
-
authenticate
Description copied from interface:AuthenticationProvider
Authenticate a request. This may be just resolving headers (tokens) or full authentication (basic auth). Do not throw exception for normal processing (e.g. invalid credentials; you may throw an exception in case of misconfiguration). This method will be invoked for inbound requests ONLY.This method must provide either a
Principal
or a wholeSubject
either for a user or for service (or both).- Specified by:
authenticate
in interfaceAuthenticationProvider
- Parameters:
providerRequest
- context of this security enforcement/validation- Returns:
- response that either authenticates the request, fails authentication or abstains from authentication
- See Also:
-
isOutboundSupported
public boolean isOutboundSupported(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundConfig) Description copied from interface:OutboundSecurityProvider
Check if the path to be executed is supported by this security provider. Defaults to true.- Specified by:
isOutboundSupported
in interfaceOutboundSecurityProvider
- Parameters:
providerRequest
- context with environment, subject(s) etc. that was receivedoutboundEnv
- environment for outbound calloutboundConfig
- outbound endpoint configuration- Returns:
- true if this identity propagator can generate required headers for the path defined
-
outboundSecurity
public OutboundSecurityResponse outboundSecurity(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundEndpointConfig) Description copied from interface:OutboundSecurityProvider
Creates necessary updates to headers and entity needed for outbound security (e.g. identity propagation, s2s security etc.). This method will be invoked for outbound requests ONLY.- Specified by:
outboundSecurity
in interfaceOutboundSecurityProvider
- Parameters:
providerRequest
- context with environment, subject(s) etc. that was receivedoutboundEnv
- environment for outbound calloutboundEndpointConfig
- outbound endpoint configuration- Returns:
- response with generated headers and other possible configuration
- See Also:
-