Package com.atlassian.confluence.oauth2
Interface OAuth2Service
-
- All Known Implementing Classes:
DefaultOAuth2Service
public interface OAuth2Service
Contract for managing OAuth 2.0 token generation- Since:
- 8.3.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
OAuth2Service.OAuth2Provider
static class
OAuth2Service.OAuth2Result
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
completeOAuth2Flow(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.ClientTokenEntity
getToken(String tokenId)
OAuth2Service.OAuth2Result
initialiseOAuth2Flow(javax.servlet.http.HttpSession session, String oAuth2ProviderId, UnaryOperator<String> buildRedirect)
Initialises the OAuth flow for the given Provider.
-
-
-
Method Detail
-
getConfiguredOAuth2Providers
List<OAuth2Service.OAuth2Provider> getConfiguredOAuth2Providers()
Returns a List of the configured OAuth Providers.- Returns:
- configured OAuth 2.0 Providers.
-
initialiseOAuth2Flow
OAuth2Service.OAuth2Result initialiseOAuth2Flow(javax.servlet.http.HttpSession session, String oAuth2ProviderId, UnaryOperator<String> buildRedirect) throws IllegalArgumentException
Initialises the OAuth flow for the given Provider.- 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
String completeOAuth2Flow(javax.servlet.http.HttpSession session, String oAuthProviderId) throws OAuth2Exception
Completes the OAuth flow for the specified Provider and generates a token if successful.- Parameters:
session
- theHttpSession
which initialised the OAuth 2.0 flow throughinitialiseOAuth2Flow(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
com.atlassian.oauth2.client.api.storage.token.ClientTokenEntity getToken(String tokenId) throws OAuth2Exception
- Throws:
OAuth2Exception
-
-