public class PCLogin
extends java.lang.Object
implements java.io.Serializable
importFromJson(String, GetLoginDataCallback)
to construct PCLogin
object. Constructed object will be returned as parameter of
success() method.suggestUsers()
on constructed object to get keys which can be used
to log inrequestLoginTransaction(PCUser, GetLoginTransactionCallback)
with a selected PCUser
from one of returned by suggestUsers()
PCLogin.GetLoginTransactionCallback.success(PCTransaction)
is invoked, you
may show transaction data in the app. Note, that the PCTransaction.getTransactionText()
can either return null or text of transaction. Do not try to sign this transaction manually,
instead call either confirm(PCGeneralCallback)
to finish logging in or
decline(PCGeneralCallback)
to cancel login operation.Modifier and Type | Class and Description |
---|---|
static interface |
PCLogin.GetLoginDataCallback
Callback for handling results from
importFromJson(String, PCLogin.GetLoginDataCallback) |
static interface |
PCLogin.GetLoginTransactionCallback
Callback for handling results from
PCLogin.GetLoginTransactionCallback |
Modifier and Type | Method and Description |
---|---|
void |
confirm(PCGeneralCallback callback)
Performs logging in after
requestLoginTransaction(PCUser, GetLoginTransactionCallback)
is finished with success for a target PCUser |
void |
confirm(PCKeysProcessor keysProcessor,
PCLoginCallback callback)
Performs logging in after
requestLoginTransaction(PCUser, GetLoginTransactionCallback)
is finished with success for a target PCUser |
void |
decline(PCGeneralCallback callback)
Cancels logging in.
|
void |
decline(PCKeysProcessor keysProcessor,
PCLoginCallback callback)
Cancels logging in.
|
static void |
importFromJson(java.lang.String data,
PCLogin.GetLoginDataCallback callback)
Creates
PCLogin object from JSON which is encoded in QR-code body |
void |
requestLoginTransaction(PCUser key,
PCLogin.GetLoginTransactionCallback callback)
Requests transaction for logging in
|
java.util.List<PCUser> |
suggestUsers()
Returns array of
PCUser objects which can be used to log in with scanned QR |
java.lang.String |
toString() |
public static void importFromJson(java.lang.String data, PCLogin.GetLoginDataCallback callback)
PCLogin
object from JSON which is encoded in QR-code bodydata
- JSON extracted from QR-codecallback
- callback to process results. If JSON is parsed successfully, PCLogin
object with all data is passed to success() methodpublic java.util.List<PCUser> suggestUsers()
PCUser
objects which can be used to log in with scanned QRPCUser
objectspublic void requestLoginTransaction(PCUser key, PCLogin.GetLoginTransactionCallback callback)
key
- User to be logged incallback
- Callback to handle results. success() is called when transaction received
successfully and confirm(PCGeneralCallback)
can be called.
PCTransaction
is passed to success() so that you can show it's data
in the app. Do not try to sign this transaction manuallypublic void confirm(PCGeneralCallback callback)
requestLoginTransaction(PCUser, GetLoginTransactionCallback)
is finished with success for a target PCUser
callback
- success() is called in case user is logged in successfully. At this step login
operation is completed on the client side.public void confirm(PCKeysProcessor keysProcessor, PCLoginCallback callback)
requestLoginTransaction(PCUser, GetLoginTransactionCallback)
is finished with success for a target PCUser
keysProcessor
- Custom keys processor which implements PCKeysProcessor
. To follow default behaviour
pass object returned by PCRegularKeysProcessor.getInstance()
or simply call
confirm(PCGeneralCallback)
instead.callback
- success() is called in case user is logged in successfully. At this step login
operation is completed on the client side.public void decline(PCGeneralCallback callback)
requestLoginTransaction(PCUser, GetLoginTransactionCallback)
is finished with
success for a target PCUser
callback
- Callback to handle resultspublic void decline(PCKeysProcessor keysProcessor, PCLoginCallback callback)
requestLoginTransaction(PCUser, GetLoginTransactionCallback)
is finished with
success for a target PCUser
keysProcessor
- Custom keys processor which implements PCKeysProcessor
. To follow default behaviour
pass object returned by PCRegularKeysProcessor.getInstance()
or simply call
decline(PCGeneralCallback)
instead.callback
- Callback to handle resultspublic java.lang.String toString()
toString
in class java.lang.Object