class RedoxTokenManager extends RedoxClientComponents
Redox uses a perishable accessToken with an expiry to authenticate requests. The accessToken is obtained by exchanging a apiKey and an apiSecret. On the first exchange we receive:
- accessToken 2. expiry time 3. refreshToken
We use the RefreshToken obtained from the first request to obtain new accessTokens as they expire.
The RedoxTokenManager schedules the refresh and storage of accessTokens and keeps them valid, so a client doesn't have to authenticate each time it makes a request.
- Alphabetic
- By Inheritance
- RedoxTokenManager
- RedoxClientComponents
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
RedoxTokenManager(client: HttpClient, baseRestUri: Uri)(implicit actorSystem: ActorSystem, materializer: Materializer)
- client
com.github.vitalsoftware.scalaredox.client.HttpClient instance
- baseRestUri
the base url for Redox REST endpoint.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
authenticate(apiKey: String, apiSecret: String): Future[AuthInfo]
Authorize to Redox, returning a Future containing the access and refresh tokens.
Authorize to Redox, returning a Future containing the access and refresh tokens.
- Attributes
- protected
-
def
basePost: Self
- Attributes
- protected
- Definition Classes
- RedoxClientComponents
-
def
baseQuery: Self
- Attributes
- protected
- Definition Classes
- RedoxClientComponents
-
def
baseRequest(url: String): StandaloneWSRequest
- Attributes
- protected
- Definition Classes
- RedoxClientComponents
-
def
baseUpload: Self
- Attributes
- protected
- Definition Classes
- RedoxClientComponents
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
execute[T](request: StandaloneWSRequest)(implicit format: Reads[T]): Future[RedoxResponse[T]]
Raw request execution
Raw request execution
- Attributes
- protected
- Definition Classes
- RedoxClientComponents
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getAccessToken(apiKey: String, apiSecret: String): Future[AuthInfo]
Returns an access token for given credentials.
Returns an access token for given credentials. If the access token doesn't exist, authorize with Redox to obtain a new access token.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
refresh(apiKey: String, auth: AuthInfo): Future[AuthInfo]
Refresh the access and refresh tokens.
Refresh the access and refresh tokens.
- Attributes
- protected
-
def
scheduleRefresh(apiKey: String, auth: AuthInfo): Unit
Refresh the auth token a minute before it expires.
Refresh the auth token a minute before it expires. Set and schedule a new refresh to occur. NOTE: If this method is overridden, scheduling and storing the new auth token will not be available to the implementing class.
- Attributes
- protected
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )