-
- All Implemented Interfaces:
-
com.gigya.android.sdk.auth.IWebAuthnService
public class WebAuthnService<A extends GigyaAccount> implements IWebAuthnService<A>
-
-
Constructor Summary
Constructors Constructor Description WebAuthnService(IOauthService oauthService, IFidoApiService fidoApiService, ISessionService sessionService, IPersistenceService persistenceService, IBusinessApiService<A> businessApiService)
-
Method Summary
Modifier and Type Method Description voidsetPasskeyAuthenticationProvider(IPasskeysAuthenticationProvider provider)The Passkey authentication provider is used to handle passkey authentication.This class is required to be updated according too application flow to retain the correctreference to the activity state (used as weak reference to avoid memory leaks).Make sure to set the provider before calling register or login methods. voidgetCredentials(GigyaCallback<GigyaApiResponse> callback)Get available credentials (credentials manager from server). voidregister(ActivityResultLauncher<IntentSenderRequest> resultLauncher, GigyaCallback<GigyaApiResponse> gigyaCallback)Initialize WebAuthn/Fido registration flow.1. voidregister(GigyaCallback<GigyaApiResponse> gigyaCallback)static Pair<WebAuthnKeyModel, String>fromAttestationResponse(String uid, String attestationJson, String optionsJson)voidonRegistration(WebAuthnOptionsBinding optionsBinding, Array<byte> attestationResponse, Array<byte> credentialResponse)Handle WebAuthn/Fido registration result. voidlogin(ActivityResultLauncher<IntentSenderRequest> resultLauncher, GigyaLoginCallback<A> gigyaCallback)Initialize WebAuthn/Fido login/signing flow.1. voidlogin(ActivityResultLauncher<IntentSenderRequest> resultLauncher, Map<String, Object> params, GigyaLoginCallback<A> gigyaCallback)*Initialize WebAuthn/Fido login/signing flow. voidlogin(GigyaLoginCallback<A> gigyaCallback)voidlogin(Map<String, Object> params, GigyaLoginCallback<A> gigyaCallback)voidonLogin(WebAuthnOptionsBinding optionsBinding, Array<byte> assertionResponse, Array<byte> fido2Credential)Handle WebAuthn/Fido login result. voidrevoke(GigyaCallback<GigyaApiResponse> gigyaCallback)Initialize revoke key flow.Revoking a key will perform its removal from Gigya services only. voidrevoke(String id, GigyaCallback<GigyaApiResponse> gigyaCallback)Initialize revoke key flow.Revoking a key will perform its removal from Gigya services only. voidhandleFidoResult(ActivityResult activityResult)Handle service activity sender result.Make sure to initialize the ActivityResultLauncher before onCreate method or as a member variable. List<WebAuthnKeyModel>getPassKeys()Get stored passkeys. booleanpasskeyForUser(String uid)Check passwordless key (FIDO2/Passkey) availability for provided user UID. -
-
Constructor Detail
-
WebAuthnService
WebAuthnService(IOauthService oauthService, IFidoApiService fidoApiService, ISessionService sessionService, IPersistenceService persistenceService, IBusinessApiService<A> businessApiService)
-
-
Method Detail
-
setPasskeyAuthenticationProvider
void setPasskeyAuthenticationProvider(IPasskeysAuthenticationProvider provider)
The Passkey authentication provider is used to handle passkey authentication.This class is required to be updated according too application flow to retain the correctreference to the activity state (used as weak reference to avoid memory leaks).Make sure to set the provider before calling register or login methods.
-
getCredentials
void getCredentials(GigyaCallback<GigyaApiResponse> callback)
Get available credentials (credentials manager from server).
-
register
void register(ActivityResultLauncher<IntentSenderRequest> resultLauncher, GigyaCallback<GigyaApiResponse> gigyaCallback)
Initialize WebAuthn/Fido registration flow.1. initRegistration - connect with site to retrieve configuration data.2. Register with FIDO2 service - retrieve key data - Sender intent will be sent.
- Parameters:
resultLauncher- Activity result launcher for intent sender request.gigyaCallback- Result callback.
-
register
void register(GigyaCallback<GigyaApiResponse> gigyaCallback)
-
fromAttestationResponse
static Pair<WebAuthnKeyModel, String> fromAttestationResponse(String uid, String attestationJson, String optionsJson)
-
onRegistration
void onRegistration(WebAuthnOptionsBinding optionsBinding, Array<byte> attestationResponse, Array<byte> credentialResponse)
Handle WebAuthn/Fido registration result.
1. registerCredentials - register device.2. oauthservice - connect.
-
login
void login(ActivityResultLauncher<IntentSenderRequest> resultLauncher, GigyaLoginCallback<A> gigyaCallback)
Initialize WebAuthn/Fido login/signing flow.1. getAssertionOptions - retrieve relevant assertion verification data.2. Sign with FIDO2 service - retrieve key data - Sender intent will be sent.
- Parameters:
resultLauncher- Activity result launcher for intent sender request.gigyaCallback- Result callback.
-
login
void login(ActivityResultLauncher<IntentSenderRequest> resultLauncher, Map<String, Object> params, GigyaLoginCallback<A> gigyaCallback)
*Initialize WebAuthn/Fido login/signing flow. Additional login parameters applied.
- Parameters:
resultLauncher- Activity result launcher for intent sender request.params- Available login parameters.gigyaCallback- Result callback.
-
login
void login(GigyaLoginCallback<A> gigyaCallback)
-
onLogin
void onLogin(WebAuthnOptionsBinding optionsBinding, Array<byte> assertionResponse, Array<byte> fido2Credential)
Handle WebAuthn/Fido login result.
1. verifyAssertion - Verify assertion data.2. oauthservice - authorize.3. oauthservice - token.
-
revoke
void revoke(GigyaCallback<GigyaApiResponse> gigyaCallback)
Initialize revoke key flow.Revoking a key will perform its removal from Gigya services only. You cannot delete a fido key from the deviceonce it has been created.
- Parameters:
gigyaCallback- Result callback.
-
revoke
void revoke(String id, GigyaCallback<GigyaApiResponse> gigyaCallback)
Initialize revoke key flow.Revoking a key will perform its removal from Gigya services only. You cannot delete a fido key from the deviceonce it has been created.
Use "getCredentials" to fetch available passkey ids.
- Parameters:
id- Identifier of the passkey to be revoked.gigyaCallback- Result callback.
-
handleFidoResult
void handleFidoResult(ActivityResult activityResult)
Handle service activity sender result.Make sure to initialize the ActivityResultLauncher before onCreate method or as a member variable.
- Parameters:
activityResult- ActivityResult from sender intent.
-
getPassKeys
List<WebAuthnKeyModel> getPassKeys()
Get stored passkeys.
-
passkeyForUser
boolean passkeyForUser(String uid)
Check passwordless key (FIDO2/Passkey) availability for provided user UID.
-
-
-
-