BankId
class provides methods to initiate and process BankID authentication and signing orders.
Most methods initiate an order and respond with orderRef
and autoStartToken
.
Use the collect(CollectRequest)
or collectAsync(CollectRequest)
methods to query the status of the order.
Each method in the class comes in two forms: synchronous and asynchronous.
The latter performs operation in a non-blocking manner and returns CompletableFuture
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(AuthenticationRequest request) Initiates an authentication order.authenticateAsync
(AuthenticationRequest request) Initiates an authentication order asynchronous.cancel
(CancelRequest request) Cancels an ongoing sign or auth order.cancelAsync
(CancelRequest request) Cancels an ongoing sign or auth order.collect
(CollectRequest request) Collects the result of a sign or auth order suing the orderRef as reference.collectAsync
(CollectRequest request) Collects the result of a sign or auth order suing the orderRef as reference asynchronous.static BankId
of
(Configuration configuration) Returns aBankId
with the given configuration.Initiates an authentication order when the user is talking to the RP over the phone.Initiates an authentication order asynchronous when the user is talking to the RP over the phone.phoneSign
(PhoneSignRequest request) Initiates a sign order over the phone.phoneSignAsync
(PhoneSignRequest request) Initiates a sign order over the phone.sign
(SignRequest request) Initiates a sign order.signAsync
(SignRequest request) Initiates a sign order asynchronous.
-
Method Details
-
of
Returns aBankId
with the given configuration.- Parameters:
configuration
- the configuration- Returns:
- an
BankId
instance - Throws:
NullPointerException
- ifconfiguration
isnull
BankIdException
- if an error occurs during initialization
-
authenticate
Initiates an authentication order.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
- Parameters:
request
- the authentication request- Returns:
- the authentication response
- Throws:
NullPointerException
- ifrequest
isnull
.BankIdException
- in case of an unexpected error.BankIdApiErrorException
- in case of an api error.BankIdApiUnexpectedResponseException
- in case of an unexpected api error.
-
authenticateAsync
Initiates an authentication order asynchronous.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
Propagates
BankIdException
if an error occurred during the authentication.- Parameters:
request
- the authentication request- Returns:
- a
CompletableFuture
that represents the asynchronous authentication operation - Throws:
NullPointerException
- ifrequest
isnull
.
-
phoneAuthenticate
Initiates an authentication order when the user is talking to the RP over the phone.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
- Parameters:
request
- the authentication request- Returns:
- the phone authentication response
- Throws:
NullPointerException
- ifrequest
isnull
.BankIdException
- in case of an unexpected error.BankIdApiErrorException
- in case of an api error.BankIdApiUnexpectedResponseException
- in case of an unexpected api error.
-
phoneAuthenticateAsync
public CompletableFuture<PhoneAuthenticateResponse> phoneAuthenticateAsync(PhoneAuthenticationRequest request) Initiates an authentication order asynchronous when the user is talking to the RP over the phone.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
Propagates
BankIdException
if an error occurred during the authentication.- Parameters:
request
- the authentication request- Returns:
- a
CompletableFuture
that represents the asynchronous phone authentication operation - Throws:
NullPointerException
- ifrequest
isnull
.
-
sign
Initiates a sign order.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
- Parameters:
request
- the sign request- Returns:
- the sign response
- Throws:
NullPointerException
- ifrequest
isnull
.BankIdException
- in case of an unexpected error.BankIdApiErrorException
- in case of an api error.BankIdApiUnexpectedResponseException
- in case of an unexpected api error.
-
signAsync
Initiates a sign order asynchronous.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
Propagates
BankIdException
if an error occurred during the sign.- Parameters:
request
- the sign request- Returns:
- a
CompletableFuture
that represents the asynchronous sign operation - Throws:
NullPointerException
- ifrequest
isnull
.
-
phoneSign
Initiates a sign order over the phone.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
- Parameters:
request
- the sign request- Returns:
- the phone sign response
- Throws:
NullPointerException
- ifrequest
isnull
.BankIdException
- in case of an unexpected error.BankIdApiErrorException
- in case of an api error.BankIdApiUnexpectedResponseException
- in case of an unexpected api error.
-
phoneSignAsync
Initiates a sign order over the phone.Use the collect method to query the status of the order. If the request is successful, the orderRef and autoStartToken is returned.
Propagates
BankIdException
if an error occurred during the phone sign.- Parameters:
request
- the sign request- Returns:
- a
CompletableFuture
that represents the asynchronous phone sign operation - Throws:
NullPointerException
- ifrequest
isnull
.
-
collect
Collects the result of a sign or auth order suing the orderRef as reference.RP should keep calling collect every two seconds as long as status indicates pending. RP must abort if status indicates failed. The user identity is returned when complete.
- Parameters:
request
- the collect request- Returns:
- the collect response
- Throws:
NullPointerException
- ifrequest
isnull
.BankIdException
- in case of an unexpected error.BankIdApiErrorException
- in case of an api error.BankIdApiUnexpectedResponseException
- in case of an unexpected api error.
-
collectAsync
Collects the result of a sign or auth order suing the orderRef as reference asynchronous.RP should keep calling collect every two seconds as long as status indicates pending. RP must abort if status indicates failed. The user identity is returned when complete.
Propagates
BankIdException
if an error occurred during the collect.- Parameters:
request
- the collect request- Returns:
- a
CompletableFuture
that represents the asynchronous collect operation - Throws:
NullPointerException
- ifrequest
isnull
.
-
cancel
Cancels an ongoing sign or auth order.This is typically used if the user cancels the order in your service or app.
- Parameters:
request
- the cancel request- Returns:
- the cancel response
- Throws:
NullPointerException
- ifrequest
isnull
.BankIdException
- in case of an unexpected error.BankIdApiErrorException
- in case of an api error.BankIdApiUnexpectedResponseException
- in case of an unexpected api error.
-
cancelAsync
Cancels an ongoing sign or auth order.This is typically used if the user cancels the order in your service or app.
Propagates
BankIdException
if an error occurred during the cancel.- Parameters:
request
- the cancel request- Returns:
- a
CompletableFuture
that represents the asynchronous cancel operation - Throws:
NullPointerException
- ifrequest
isnull
.
-