Class ResourceOwnerPasswordTokenAuthenticator
java.lang.Object
org.shakespeareframework.retrofit.oauth2.RetryingTokenAuthenticator
org.shakespeareframework.retrofit.oauth2.ResourceOwnerPasswordTokenAuthenticator
- All Implemented Interfaces:
okhttp3.Authenticator
RetryingTokenAuthenticator
to automatically authenticate with the Oauth2Api
via
resource owner password
flow (grant type password
) and add the access token as a header.
Also note that refresh tokens are currently ignored!
-
Nested Class Summary
Nested classes/interfaces inherited from interface okhttp3.Authenticator
okhttp3.Authenticator.Companion
-
Field Summary
Fields inherited from class org.shakespeareframework.retrofit.oauth2.RetryingTokenAuthenticator
oauth2Api
Fields inherited from interface okhttp3.Authenticator
Companion, JAVA_NET_AUTHENTICATOR, NONE
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.shakespeareframework.retrofit.oauth2.RetryingTokenAuthenticator
authenticate
-
Constructor Details
-
ResourceOwnerPasswordTokenAuthenticator
public ResourceOwnerPasswordTokenAuthenticator(String tokenServiceUrl, String username, String password, String clientId, String clientSecret, String scope) - Parameters:
tokenServiceUrl
- the URl of the token service.username
- the usernamepassword
- the passwordclientId
- the client IDclientSecret
- the client secretscope
- the scope
-
-
Method Details
-
getToken
- Specified by:
getToken
in classRetryingTokenAuthenticator
- Returns:
- a valid token
-