Package io.jmix.email.authentication
Interface OAuth2AuthorizationCodeFlow
- All Known Implementing Classes:
GoogleOAuth2AuthorizationCodeFlow,MicrosoftOAuth2AuthorizationCodeFlow
@NullMarked
public interface OAuth2AuthorizationCodeFlow
Interface defining the OAuth2 authorization code flow used to connect a mailbox account:
the user is redirected to the provider consent page and returns to the application callback
with an authorization code.
-
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.
-
Method Details
-
buildAuthorizationUrl
Builds the provider consent page URL.- 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
Exchanges the authorization code received on the callback for tokens and stores the obtained refresh token viaEmailRefreshTokenManager.- Parameters:
authorizationCode- code received on the redirect URIredirectUri- the same redirect URI that was used to build the authorization URL- Throws:
IllegalStateException- if the exchange fails or the response contains no refresh token
-