Search in sources :

Example 1 with UserCredentialManager

use of org.keycloak.models.UserCredentialManager in project keycloak by keycloak.

the class WebAuthnDataWrapper method init.

private void init() {
    final UserModel user = session.users().getUserByUsername(session.getContext().getRealm(), username);
    if (user == null)
        return;
    final UserCredentialManager userCredentialManager = session.userCredentialManager();
    if (userCredentialManager == null)
        return;
    final CredentialModel credential = userCredentialManager.getStoredCredentialsByTypeStream(session.getContext().getRealm(), user, credentialType).findFirst().orElse(null);
    if (credential == null)
        return;
    this.webAuthnData = createFromCredentialModel(credential).getWebAuthnCredentialData();
}
Also used : UserModel(org.keycloak.models.UserModel) UserCredentialManager(org.keycloak.models.UserCredentialManager) CredentialModel(org.keycloak.credential.CredentialModel) WebAuthnCredentialModel.createFromCredentialModel(org.keycloak.models.credential.WebAuthnCredentialModel.createFromCredentialModel)

Aggregations

CredentialModel (org.keycloak.credential.CredentialModel)1 UserCredentialManager (org.keycloak.models.UserCredentialManager)1 UserModel (org.keycloak.models.UserModel)1 WebAuthnCredentialModel.createFromCredentialModel (org.keycloak.models.credential.WebAuthnCredentialModel.createFromCredentialModel)1