Class DefaultOAuth2Service
java.lang.Object
com.atlassian.confluence.impl.oauth2.DefaultOAuth2Service
- All Implemented Interfaces:
OAuth2Service
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.confluence.oauth2.OAuth2Service
OAuth2Service.OAuth2Provider, OAuth2Service.OAuth2Result
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultOAuth2Service
(com.atlassian.oauth2.client.api.storage.config.ClientConfigStorageService clientConfigStorageService, com.atlassian.oauth2.client.api.storage.token.ClientTokenStorageService clientTokenStorageService, com.atlassian.oauth2.client.api.lib.flow.FlowRequestService flowRequestService, com.atlassian.oauth2.client.api.storage.TokenHandler tokenHandler) -
Method Summary
Modifier and TypeMethodDescriptioncompleteOAuth2Flow
(javax.servlet.http.HttpSession session, String oAuthProviderId) Completes the OAuth flow for the specified Provider and generates a token if successful.Returns a List of the configured OAuth Providers.com.atlassian.oauth2.client.api.ClientToken
getRefreshedToken
(String token) com.atlassian.oauth2.client.api.storage.token.ClientTokenEntity
initialiseOAuth2Flow
(javax.servlet.http.HttpSession session, String oAuth2ProviderId, UnaryOperator<String> buildRedirect) Initialises the OAuth flow for the given Provider.
-
Constructor Details
-
DefaultOAuth2Service
public DefaultOAuth2Service(com.atlassian.oauth2.client.api.storage.config.ClientConfigStorageService clientConfigStorageService, com.atlassian.oauth2.client.api.storage.token.ClientTokenStorageService clientTokenStorageService, com.atlassian.oauth2.client.api.lib.flow.FlowRequestService flowRequestService, com.atlassian.oauth2.client.api.storage.TokenHandler tokenHandler)
-
-
Method Details
-
getConfiguredOAuth2Providers
Description copied from interface:OAuth2Service
Returns a List of the configured OAuth Providers.- Specified by:
getConfiguredOAuth2Providers
in interfaceOAuth2Service
- Returns:
- configured OAuth 2.0 Providers.
-
initialiseOAuth2Flow
public OAuth2Service.OAuth2Result initialiseOAuth2Flow(javax.servlet.http.HttpSession session, String oAuth2ProviderId, UnaryOperator<String> buildRedirect) throws IllegalArgumentException Description copied from interface:OAuth2Service
Initialises the OAuth flow for the given Provider.- Specified by:
initialiseOAuth2Flow
in interfaceOAuth2Service
- Parameters:
session
- the currentHttpSession
which will be associated with the OAuth 2.0 flowoAuth2ProviderId
- the configured OAuth 2.0 Provider idbuildRedirect
- a function which constructs the OAuth 2.0 redirect- Returns:
- the OAuth Provider FlowResult which contains the Flow identifier and redirect URL.
- Throws:
IllegalArgumentException
-
completeOAuth2Flow
public String completeOAuth2Flow(javax.servlet.http.HttpSession session, String oAuthProviderId) throws OAuth2Exception Description copied from interface:OAuth2Service
Completes the OAuth flow for the specified Provider and generates a token if successful.- Specified by:
completeOAuth2Flow
in interfaceOAuth2Service
- Parameters:
session
- theHttpSession
which initialised the OAuth 2.0 flow throughOAuth2Service.initialiseOAuth2Flow(HttpSession, String, UnaryOperator)
oAuthProviderId
- the configured OAuth 2.0 Provider ID- Returns:
- the OAuth token identifier.
- Throws:
OAuth2Exception
- if the flow has not been initialised for the given Provider within the current session.
-
getToken
public com.atlassian.oauth2.client.api.storage.token.ClientTokenEntity getToken(String tokenId) throws OAuth2Exception - Specified by:
getToken
in interfaceOAuth2Service
- Throws:
OAuth2Exception
-
getRefreshedToken
public com.atlassian.oauth2.client.api.ClientToken getRefreshedToken(String token) throws OAuth2Exception - Specified by:
getRefreshedToken
in interfaceOAuth2Service
- Throws:
OAuth2Exception
-