public class Auth
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Auth.AuthMethod
Authentication methods
|
static class |
Auth.AuthOptions
Authentication options when instancing the Ably library
|
static interface |
Auth.TokenCallback
An interface implemented by a callback that provides either tokens,
or signed token requests, in response to a request with given token params.
|
static class |
Auth.TokenDetails
A class providing details of a token and its associated metadata,
provided when the system successfully requests a token from the system.
|
static class |
Auth.TokenParams
A class providing parameters of a token request.
|
static class |
Auth.TokenRequest
A class providing parameters of a token request.
|
| Modifier and Type | Method and Description |
|---|---|
Auth.TokenDetails |
authorise(Auth.AuthOptions options,
Auth.TokenParams params,
boolean force)
Ensure valid auth credentials are present.
|
Auth.TokenRequest |
createTokenRequest(Auth.AuthOptions options,
Auth.TokenParams params)
Create a signed token request based on known credentials
and the given token params.
|
Auth.AuthMethod |
getAuthMethod()
Get the authentication method for this library instance.
|
Param[] |
getAuthParams()
Get query params representing the current authentication method and credentials.
|
java.lang.String |
getBasicCredentials()
Get the credentials for HTTP basic auth, if available.
|
TokenAuth |
getTokenAuth() |
void |
onAuthError(ErrorInfo err) |
Auth.TokenDetails |
requestToken(Auth.AuthOptions options,
Auth.TokenParams params)
Make a token request.
|
static long |
timestamp() |
public Auth.TokenDetails authorise(Auth.AuthOptions options, Auth.TokenParams params, boolean force) throws AblyException
params - an object containing the request params:
- key: (optional) the key to use; if not specified, the key
passed in constructing the Rest interface may be used
- ttl: (optional) the requested life of any new token in ms. If none
is specified a default of 1 hour is provided. The maximum lifetime
is 24hours; any request exceeeding that lifetime will be rejected
with an error.
- capability: (optional) the capability to associate with the access token.
If none is specified, a token will be requested with all of the
capabilities of the specified key.
- clientId: (optional) a client Id to associate with the token
- timestamp: (optional) the time in ms since the epoch. If none is specified,
the system will be queried for a time value to use.
- queryTime (optional) boolean indicating that the Ably system should be
queried for the current time when none is specified explicitly.
- force (optional) boolean indicating that a new token should be requested,
even if a current token is still valid.callback - (err, tokenDetails)AblyExceptionpublic Auth.TokenDetails requestToken(Auth.AuthOptions options, Auth.TokenParams params) throws AblyException
options: - see authorise(io.ably.lib.rest.Auth.AuthOptions, io.ably.lib.rest.Auth.TokenParams, boolean) for optionsparams: - see authorise(io.ably.lib.rest.Auth.AuthOptions, io.ably.lib.rest.Auth.TokenParams, boolean) for paramsAblyExceptionpublic Auth.TokenRequest createTokenRequest(Auth.AuthOptions options, Auth.TokenParams params) throws AblyException
options: - see authorise(io.ably.lib.rest.Auth.AuthOptions, io.ably.lib.rest.Auth.TokenParams, boolean) for optionsparams: - see authorise(io.ably.lib.rest.Auth.AuthOptions, io.ably.lib.rest.Auth.TokenParams, boolean) for paramsAblyExceptionpublic Auth.AuthMethod getAuthMethod()
public java.lang.String getBasicCredentials()
public Param[] getAuthParams() throws AblyException
AblyExceptionpublic TokenAuth getTokenAuth()
public void onAuthError(ErrorInfo err)
public static long timestamp()