Class AuthCodeGrantImpl
java.lang.Object
org.glassfish.jersey.client.oauth2.AuthCodeGrantImpl
- All Implemented Interfaces:
OAuth2CodeGrantFlow
Default implementation of
OAuth2CodeGrantFlow.- Since:
- 2.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classBuilder implementation.(package private) static classNested classes/interfaces inherited from interface OAuth2CodeGrantFlow
OAuth2CodeGrantFlow.Phase -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Stringprivate final javax.ws.rs.client.Clientprivate final ClientIdentifierprivate final Stringprivate TokenResult -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAuthCodeGrantImpl(String authorizationUri, String accessTokenUri, String redirectUri, String refreshTokenUri, ClientIdentifier clientIdentifier, String scope, javax.ws.rs.client.Client client, Map<String, String> authorizationProperties, Map<String, String> accessTokenProperties, Map<String, String> refreshTokenProperties) -
Method Summary
Modifier and TypeMethodDescriptionprivate javax.ws.rs.client.ClientconfigureClient(javax.ws.rs.client.Client client) Finish the authorization process and return theTokenResult.javax.ws.rs.client.ClientReturn the client configured for performing authorized requests to the Service Provider.javax.ws.rs.core.FeatureReturn theoauth filter featurethat can be used to configureclientinstances to perform authenticated requests to the Service Provider.private voidinitDefaultProperties(String redirectUri, String scope) refreshAccessToken(String refreshToken) Refresh the access token using a refresh token.private voidstart()Start the authorization process and return redirection URI on which the user should give a consent for our application to access resources.
-
Field Details
-
accessTokenUri
-
authorizationUri
-
refreshTokenUri
-
clientIdentifier
-
client
private final javax.ws.rs.client.Client client -
authorizationProperties
-
accessTokenProperties
-
refreshTokenProperties
-
tokenResult
-
-
Constructor Details
-
AuthCodeGrantImpl
private AuthCodeGrantImpl(String authorizationUri, String accessTokenUri, String redirectUri, String refreshTokenUri, ClientIdentifier clientIdentifier, String scope, javax.ws.rs.client.Client client, Map<String, String> authorizationProperties, Map<String, String> accessTokenProperties, Map<String, String> refreshTokenProperties)
-
-
Method Details
-
configureClient
private javax.ws.rs.client.Client configureClient(javax.ws.rs.client.Client client) -
setDefaultProperty
-
initDefaultProperties
-
start
Description copied from interface:OAuth2CodeGrantFlowStart the authorization process and return redirection URI on which the user should give a consent for our application to access resources.- Specified by:
startin interfaceOAuth2CodeGrantFlow- Returns:
- URI to which user should be redirected.
-
finish
Description copied from interface:OAuth2CodeGrantFlowFinish the authorization process and return theTokenResult. The method must be called on the same instance after theOAuth2CodeGrantFlow.start()method was called and user granted access to this application.The method makes a request to the Authorization Server in order to exchange
codefor access token.- Specified by:
finishin interfaceOAuth2CodeGrantFlow- Parameters:
authorizationCode- Code received from the user authorization process.state- State received from the user authorization response.- Returns:
- Token result.
-
refreshAccessToken
Description copied from interface:OAuth2CodeGrantFlowRefresh the access token using a refresh token. This method can be called on newly created instance or on instance on which the authorization flow was already performed.- Specified by:
refreshAccessTokenin interfaceOAuth2CodeGrantFlow- Parameters:
refreshToken- Refresh token.- Returns:
- Token result.
-
getAuthorizedClient
public javax.ws.rs.client.Client getAuthorizedClient()Description copied from interface:OAuth2CodeGrantFlowReturn the client configured for performing authorized requests to the Service Provider. The authorization process must be successfully finished by instance by calling methodsOAuth2CodeGrantFlow.start()andOAuth2CodeGrantFlow.finish(String, String).- Specified by:
getAuthorizedClientin interfaceOAuth2CodeGrantFlow- Returns:
- Client configured to add correct
Authorizationheader to requests.
-
getOAuth2Feature
public javax.ws.rs.core.Feature getOAuth2Feature()Description copied from interface:OAuth2CodeGrantFlowReturn 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
OAuth2CodeGrantFlow.start()andOAuth2CodeGrantFlow.finish(String, String).- Specified by:
getOAuth2Featurein interfaceOAuth2CodeGrantFlow- Returns:
- oauth filter feature configured with received
AccessToken.
-