Class DefaultOAuth2Service
- java.lang.Object
-
- com.atlassian.confluence.impl.oauth2.DefaultOAuth2Service
-
- All Implemented Interfaces:
OAuth2Service
public class DefaultOAuth2Service extends Object implements OAuth2Service
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.oauth2.OAuth2Service
OAuth2Service.OAuth2Provider, OAuth2Service.OAuth2Result
-
-
Constructor Summary
Constructors Constructor Description 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcompleteOAuth2Flow(javax.servlet.http.HttpSession session, String oAuthProviderId)Completes the OAuth flow for the specified Provider and generates a token if successful.List<OAuth2Service.OAuth2Provider>getConfiguredOAuth2Providers()Returns a List of the configured OAuth Providers.com.atlassian.oauth2.client.api.storage.token.ClientTokenEntitygetToken(String tokenId)OAuth2Service.OAuth2ResultinitialiseOAuth2Flow(javax.servlet.http.HttpSession session, String oAuth2ProviderId, UnaryOperator<String> buildRedirect)Initialises the OAuth flow for the given Provider.
-
-
-
Constructor Detail
-
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)
-
-
Method Detail
-
getConfiguredOAuth2Providers
public List<OAuth2Service.OAuth2Provider> getConfiguredOAuth2Providers()
Description copied from interface:OAuth2ServiceReturns a List of the configured OAuth Providers.- Specified by:
getConfiguredOAuth2Providersin 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:OAuth2ServiceInitialises the OAuth flow for the given Provider.- Specified by:
initialiseOAuth2Flowin interfaceOAuth2Service- Parameters:
session- the currentHttpSessionwhich 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:OAuth2ServiceCompletes the OAuth flow for the specified Provider and generates a token if successful.- Specified by:
completeOAuth2Flowin interfaceOAuth2Service- Parameters:
session- theHttpSessionwhich 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:
getTokenin interfaceOAuth2Service- Throws:
OAuth2Exception
-
-