public final class ChallengeContext
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
enroll(java.lang.String endpointUrl,
OAuthToken token,
IEnrollment enrollment,
IEnrollmentHandleResult callback)
Enroll a challenge mechanism for a device.
|
void |
invoke(java.lang.String endpointUrl,
OAuthToken token,
IChallengeCallbackHandleResult callback)
Invokes a known policy enforcement point.
|
java.lang.String[] |
mechanismIdentifiers()
Returns an array of registered mechanism identifiers.
|
void |
pendingTransactions(java.lang.String endpointUrl,
OAuthToken token,
boolean nextTransaction,
java.util.Comparator<PendingTransaction> orderBy,
IPendingTransactionCallback callback)
Executes a query for pending transactions requiring a challenge.
|
void |
pendingTransactions(java.lang.String endpointUrl,
OAuthToken token,
boolean nextTransaction,
IPendingTransactionCallback callback)
Executes a query for pending transactions requiring a challenge.
|
void |
pendingTransactions(java.lang.String endpointUrl,
OAuthToken token,
java.util.Comparator<PendingTransaction> orderBy,
IPendingTransactionCallback callback)
Executes a query for pending transactions requiring a challenge.
|
void |
pendingTransactions(java.lang.String endpointUrl,
OAuthToken token,
IPendingTransactionCallback callback)
Executes a query for pending transactions requiring a challenge.
|
void |
pendingTransactions(java.lang.String endpointUrl,
OAuthToken token,
java.lang.String transactionId,
IPendingTransactionCallback callback)
Executes a query for pending transactions requiring a challenge.
|
void |
register(IChallenge mechanism)
Registers an instance of a
IChallenge . |
void |
register(IChallenge[] mechanisms)
Registers an array of
IChallenge instances. |
void |
setConnectionTimeOut(int connectionTimeOut)
Sets the connection timeout to a specified timeout, in milliseconds.
|
void |
setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
Sets the
HostnameVerifier to use self-signed or unknown certificates for HttpsURLConnection ,
so that the host name is an acceptable match with the server's authentication scheme. |
void |
setReadTimeOut(int readTimeOut)
Sets the read timeout to a specified timeout, in milliseconds.
|
void |
setSslContext(javax.net.ssl.SSLContext sslContext)
Sets the
SSLContext to use self-signed or unknown certificates for HttpsURLConnection . |
static ChallengeContext |
sharedInstance()
Returns an instance of a new
ChallengeContext object. |
java.lang.String |
toString()
Returns a textually representation of the instance with attribute names and values.
|
void |
unenroll(java.lang.String endpointUrl,
OAuthToken token,
java.lang.String authenticatorId,
java.lang.String enrollmentType,
IUnenrollHandleResult callback)
Unenroll a challenge mechanism for a device.
|
void |
unregister(IChallenge mechanism)
Unregister an
IChallenge instances. |
void |
verify(java.lang.String endpointUrl,
OAuthToken token,
java.util.Map<java.lang.String,java.lang.String> map,
IChallengeCallbackHandleVerify callback)
Submits the mechanism for verification.
|
public static ChallengeContext sharedInstance()
ChallengeContext
object.ChallengeContext
object.public java.lang.String[] mechanismIdentifiers()
public void register(IChallenge mechanism)
IChallenge
.mechanism
- the mechanism IChallenge
typepublic void register(IChallenge[] mechanisms)
IChallenge
instances.mechanisms
- an array of mechanisms to registerpublic void unregister(IChallenge mechanism)
IChallenge
instances.mechanism
- mechanisms to deregisterpublic void invoke(java.lang.String endpointUrl, OAuthToken token, IChallengeCallbackHandleResult callback) throws java.lang.IllegalArgumentException
Redirects to the same protocol (HTTPS to HTTPS) will be followed automatically. Redirects
where the protocol changes (HTTP to HTTPS or vice versa) are not followed automatically.
Instead the callback receives a MobileKitException
, most likely with a JSON parsing
error.
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requestcallback
- the function delegate that is invoked with the ChallengeResult
java.lang.IllegalArgumentException
- if callback is nullpublic void verify(java.lang.String endpointUrl, OAuthToken token, java.util.Map<java.lang.String,java.lang.String> map, IChallengeCallbackHandleVerify callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requestmap
- a Map
representing the postback challenge datacallback
- the function delegate that is invoked with the ChallengeResult
java.lang.IllegalArgumentException
- if callback is nullpublic void setReadTimeOut(int readTimeOut) throws java.lang.IllegalArgumentException
30000
.readTimeOut
- time out in millisecondsjava.lang.IllegalArgumentException
- if parameter is <= 0public void setConnectionTimeOut(int connectionTimeOut) throws java.lang.IllegalArgumentException
30000
.connectionTimeOut
- time out in millisecondsjava.lang.IllegalArgumentException
- if parameter is <= 0public void setSslContext(javax.net.ssl.SSLContext sslContext)
SSLContext
to use self-signed or unknown certificates for HttpsURLConnection
.
If sslContext is not null, it will be used to validate the HttpsURLConnection
,
otherwise it won't be set.
One way to provide a sslContext is described here
sslContext
- a SSLContext instance that contains the list of certificatespublic void setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
HostnameVerifier
to use self-signed or unknown certificates for HttpsURLConnection
,
so that the host name is an acceptable match with the server's authentication scheme.
hostnameVerifier
will only be set if sslContext
is set as well (not null).
If hostnameVerifier is not null, the overwritten HostnameVerifier.verify(String, SSLSession)
method will be invoked to verify the host name. Otherwise the inherited HostnameVerifier
instance is used.
hostnameVerifier
- a HostnameVerifier
instance that contains an overwritten
HostnameVerifier.verify(String, SSLSession)
methodpublic void unenroll(java.lang.String endpointUrl, OAuthToken token, java.lang.String authenticatorId, java.lang.String enrollmentType, IUnenrollHandleResult callback) throws java.lang.IllegalArgumentException
Redirects to the same protocol (HTTPS to HTTPS) will be followed automatically. Redirects
where the protocol changes (HTTP to HTTPS or vice versa) are not followed automatically.
Instead the callback receives a MobileKitException
, most likely with a JSON parsing
error.
endpointUrl
- the location of the endpoint to unenroll a challengetoken
- the OAuthToken
to consume with the requestauthenticatorId
- the identifier of the deviceenrollmentType
- the type of enrollmentcallback
- the function delegate that is invoked with the UnenrollResult
java.lang.IllegalArgumentException
- if callback is nullpublic void enroll(java.lang.String endpointUrl, OAuthToken token, IEnrollment enrollment, IEnrollmentHandleResult callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the endpoint to enroll a challengetoken
- the OAuthToken
to consume with the requestenrollment
- the IEnrollment
interface, representing the enrollment objectcallback
- the function delegate that is invoked with the EnrollmentResult
java.lang.IllegalArgumentException
- if callback is nullpublic void pendingTransactions(java.lang.String endpointUrl, OAuthToken token, boolean nextTransaction, java.util.Comparator<PendingTransaction> orderBy, IPendingTransactionCallback callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requestnextTransaction
- filters the transactions only to return the next pending.orderBy
- a Comparator<PendingTransaction>
that orders the list of transactions. If the parameter is
null, the transactions get ordered descending by their PendingTransaction.createdDate
(newest first).callback
- the function delegate that is invoked with PendingTransactionsResult
java.lang.IllegalArgumentException
- if callback is nullpublic void pendingTransactions(java.lang.String endpointUrl, OAuthToken token, java.util.Comparator<PendingTransaction> orderBy, IPendingTransactionCallback callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requestorderBy
- a Comparator<PendingTransaction>
that orders the list of transactions. If the parameter is
null, the transactions get ordered descending by their PendingTransaction.createdDate
(newest first).callback
- the function delegate that is invoked with PendingTransactionsResult
java.lang.IllegalArgumentException
- if callback is nullpublic void pendingTransactions(java.lang.String endpointUrl, OAuthToken token, IPendingTransactionCallback callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requestcallback
- the function delegate that is invoked with PendingTransactionsResult
java.lang.IllegalArgumentException
- if callback is nullpublic void pendingTransactions(java.lang.String endpointUrl, OAuthToken token, boolean nextTransaction, IPendingTransactionCallback callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requestnextTransaction
- filters the transactions only to return the next pending.callback
- the function delegate that is invoked with PendingTransactionsResult
java.lang.IllegalArgumentException
- if callback is nullpublic void pendingTransactions(java.lang.String endpointUrl, OAuthToken token, java.lang.String transactionId, IPendingTransactionCallback callback) throws java.lang.IllegalArgumentException
endpointUrl
- the location of the policy endpointtoken
- the OAuthToken
to consume with the requesttransactionId
- the unique identifier of the transactioncallback
- the function delegate that is invoked with PendingTransactionsResult
java.lang.IllegalArgumentException
- if callback is nullpublic java.lang.String toString()
toString
in class java.lang.Object