Class GoogleOAuth2AuthorizationCodeFlow
java.lang.Object
io.jmix.email.authentication.impl.AbstractOAuth2Flow
io.jmix.email.authentication.impl.GoogleOAuth2AuthorizationCodeFlow
- All Implemented Interfaces:
OAuth2AuthorizationCodeFlow
@NullMarked
public class GoogleOAuth2AuthorizationCodeFlow
extends AbstractOAuth2Flow
implements OAuth2AuthorizationCodeFlow
Authorization code flow for Google accounts. The authorization URL requests
access_type=offline and prompt=consent so that the token response always
contains a refresh token.-
Field Summary
FieldsFields inherited from class io.jmix.email.authentication.impl.AbstractOAuth2Flow
emailerProperties, refreshTokenManager -
Constructor Summary
ConstructorsConstructorDescriptionGoogleOAuth2AuthorizationCodeFlow(EmailerProperties emailerProperties, EmailRefreshTokenManager refreshTokenManager) -
Method Summary
Modifier and TypeMethodDescriptionbuildAuthorizationUrl(String redirectUri, String state) Builds the provider consent page URL.voidcompleteAuthorization(String authorizationCode, String redirectUri) Exchanges the authorization code received on the callback for tokens and stores the obtained refresh token viaEmailRefreshTokenManager.protected Stringprotected StringgetScope()protected Stringprotected StringMethods inherited from class io.jmix.email.authentication.impl.AbstractOAuth2Flow
encodeForm, getClientId, getRequiredProperty, getSecret
-
Field Details
-
AUTHORIZATION_ENDPOINT
- See Also:
-
TOKEN_ENDPOINT
- See Also:
-
-
Constructor Details
-
GoogleOAuth2AuthorizationCodeFlow
public GoogleOAuth2AuthorizationCodeFlow(EmailerProperties emailerProperties, EmailRefreshTokenManager refreshTokenManager)
-
-
Method Details
-
buildAuthorizationUrl
Description copied from interface:OAuth2AuthorizationCodeFlowBuilds the provider consent page URL.- Specified by:
buildAuthorizationUrlin interfaceOAuth2AuthorizationCodeFlow- Parameters:
redirectUri- application callback URI registered for the OAuth clientstate- opaque value used to protect the round trip against CSRF- Returns:
- URL to redirect the user to
-
completeAuthorization
Description copied from interface:OAuth2AuthorizationCodeFlowExchanges the authorization code received on the callback for tokens and stores the obtained refresh token viaEmailRefreshTokenManager.- Specified by:
completeAuthorizationin interfaceOAuth2AuthorizationCodeFlow- Parameters:
authorizationCode- code received on the redirect URIredirectUri- the same redirect URI that was used to build the authorization URL
-
postForm
protected String postForm(String url, Map<String, String> formParameters) throws IOException, InterruptedException- Throws:
IOExceptionInterruptedException
-
getScope
-
getAuthorizationEndpoint
-
getTokenEndpoint
-