Class OAuth1AuthorizationFlowImpl
- java.lang.Object
-
- org.glassfish.jersey.client.oauth1.OAuth1AuthorizationFlowImpl
-
- All Implemented Interfaces:
OAuth1AuthorizationFlow
class OAuth1AuthorizationFlowImpl extends java.lang.Object implements OAuth1AuthorizationFlow
Default implementation ofOAuth1AuthorizationFlow. The instance is used to perform authorization flows.- Since:
- 2.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classOAuth1AuthorizationFlowImpl.BuilderOAuth1AuthorizationFlowImpl builder.
-
Field Summary
Fields Modifier and Type Field Description private AccessTokenaccessTokenprivate java.lang.StringaccessTokenUriprivate java.lang.StringauthorizationUriprivate javax.ws.rs.client.Clientclientprivate static java.util.logging.LoggerLOGGERprivate Value<javax.ws.rs.core.Feature>oAuth1ClientFilterFeatureprivate OAuth1ParametersparametersThe OAuth parameters to be used in generating signature.private java.lang.StringrequestTokenUriprivate OAuth1SecretssecretsThe OAuth secrets to be used in generating signature.
-
Constructor Summary
Constructors Modifier Constructor Description privateOAuth1AuthorizationFlowImpl(OAuth1Parameters params, OAuth1Secrets secrets, java.lang.String requestTokenUri, java.lang.String accessTokenUri, java.lang.String authorizationUri, java.lang.String callbackUri, javax.ws.rs.client.Client client, boolean enableLogging)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.ws.rs.client.Invocation.BuilderaddProperties(javax.ws.rs.client.Invocation.Builder invocationBuilder)AccessTokenfinish()Finish the authorization process and return theAccessToken.AccessTokenfinish(java.lang.String verifier)Finish the authorization process and return theAccessToken.javax.ws.rs.client.ClientgetAuthorizedClient()Return the client configured for performing authorized requests to the Service Provider.javax.ws.rs.core.FeaturegetOAuth1Feature()Return theoauth filter featurethat can be used to configureclientinstances to perform authenticated requests to the Service Provider.java.lang.Stringstart()Start the authorization process and return redirection URI on which the user should give a consent for our application to access resources.
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
parameters
private final OAuth1Parameters parameters
The OAuth parameters to be used in generating signature.
-
secrets
private final OAuth1Secrets secrets
The OAuth secrets to be used in generating signature.
-
requestTokenUri
private final java.lang.String requestTokenUri
-
accessTokenUri
private final java.lang.String accessTokenUri
-
authorizationUri
private final java.lang.String authorizationUri
-
client
private final javax.ws.rs.client.Client client
-
accessToken
private volatile AccessToken accessToken
-
oAuth1ClientFilterFeature
private final Value<javax.ws.rs.core.Feature> oAuth1ClientFilterFeature
-
-
Constructor Detail
-
OAuth1AuthorizationFlowImpl
private OAuth1AuthorizationFlowImpl(OAuth1Parameters params, OAuth1Secrets secrets, java.lang.String requestTokenUri, java.lang.String accessTokenUri, java.lang.String authorizationUri, java.lang.String callbackUri, javax.ws.rs.client.Client client, boolean enableLogging)
-
-
Method Detail
-
addProperties
private javax.ws.rs.client.Invocation.Builder addProperties(javax.ws.rs.client.Invocation.Builder invocationBuilder)
-
start
public java.lang.String start()
Description copied from interface:OAuth1AuthorizationFlowStart the authorization process and return redirection URI on which the user should give a consent for our application to access resources.Note: the method makes a request to the Authorization Server in order to get request token.
- Specified by:
startin interfaceOAuth1AuthorizationFlow- Returns:
- URI to which user should be redirected.
-
finish
public AccessToken finish()
Description copied from interface:OAuth1AuthorizationFlowFinish the authorization process and return theAccessToken. The method must be called on the same instance after theOAuth1AuthorizationFlow.start()method was called and user granted access to this application.The method makes a request to the Authorization Server but does not exchange verifier for access token. This method is intended only for some flows/cases in OAuth1.
- Specified by:
finishin interfaceOAuth1AuthorizationFlow- Returns:
- Access token.
-
finish
public AccessToken finish(java.lang.String verifier)
Description copied from interface:OAuth1AuthorizationFlowFinish the authorization process and return theAccessToken. The method must be called on the same instance after theOAuth1AuthorizationFlow.start()method was called and user granted access to this application.The method makes a request to the Authorization Server in order to exchange verifier for access token.
- Specified by:
finishin interfaceOAuth1AuthorizationFlow- Parameters:
verifier- Verifier provided from the user authorization.- Returns:
- Access token.
-
getAuthorizedClient
public javax.ws.rs.client.Client getAuthorizedClient()
Description copied from interface:OAuth1AuthorizationFlowReturn the client configured for performing authorized requests to the Service Provider. The authorization process must be successfully finished by instance by calling methodsOAuth1AuthorizationFlow.start()andOAuth1AuthorizationFlow.finish(String).- Specified by:
getAuthorizedClientin interfaceOAuth1AuthorizationFlow- Returns:
- Client configured to add correct
Authorizationheader to requests.
-
getOAuth1Feature
public javax.ws.rs.core.Feature getOAuth1Feature()
Description copied from interface:OAuth1AuthorizationFlowReturn theoauth filter featurethat can be used to configureclientinstances to perform authenticated requests to the Service Provider.The authorization process must be successfully finished by instance by calling methods
OAuth1AuthorizationFlow.start()andOAuth1AuthorizationFlow.finish(String).- Specified by:
getOAuth1Featurein interfaceOAuth1AuthorizationFlow- Returns:
- oauth filter feature configured with received
AccessToken.
-
-