Search in sources :

Example 1 with WebAuthnSecretData

use of org.keycloak.models.credential.dto.WebAuthnSecretData in project keycloak by keycloak.

the class WebAuthnCredentialModel method create.

public static WebAuthnCredentialModel create(String credentialType, String userLabel, String aaguid, String credentialId, String attestationStatement, String credentialPublicKey, long counter, String attestationStatementFormat, Set<String> transports) {
    WebAuthnCredentialData credentialData = new WebAuthnCredentialData(aaguid, credentialId, counter, attestationStatement, credentialPublicKey, attestationStatementFormat, transports);
    WebAuthnSecretData secretData = new WebAuthnSecretData();
    WebAuthnCredentialModel credentialModel = new WebAuthnCredentialModel(credentialType, credentialData, secretData);
    credentialModel.fillCredentialModelFields();
    credentialModel.setUserLabel(userLabel);
    return credentialModel;
}
Also used : WebAuthnCredentialData(org.keycloak.models.credential.dto.WebAuthnCredentialData) WebAuthnSecretData(org.keycloak.models.credential.dto.WebAuthnSecretData)

Example 2 with WebAuthnSecretData

use of org.keycloak.models.credential.dto.WebAuthnSecretData in project keycloak by keycloak.

the class WebAuthnCredentialModel method createFromCredentialModel.

public static WebAuthnCredentialModel createFromCredentialModel(CredentialModel credentialModel) {
    try {
        WebAuthnCredentialData credentialData = JsonSerialization.readValue(credentialModel.getCredentialData(), WebAuthnCredentialData.class);
        WebAuthnSecretData secretData = JsonSerialization.readValue(credentialModel.getSecretData(), WebAuthnSecretData.class);
        WebAuthnCredentialModel webAuthnCredentialModel = new WebAuthnCredentialModel(credentialModel.getType(), credentialData, secretData);
        webAuthnCredentialModel.setUserLabel(credentialModel.getUserLabel());
        webAuthnCredentialModel.setCreatedDate(credentialModel.getCreatedDate());
        webAuthnCredentialModel.setType(credentialModel.getType());
        webAuthnCredentialModel.setId(credentialModel.getId());
        webAuthnCredentialModel.setSecretData(credentialModel.getSecretData());
        webAuthnCredentialModel.setCredentialData(credentialModel.getCredentialData());
        return webAuthnCredentialModel;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : WebAuthnCredentialData(org.keycloak.models.credential.dto.WebAuthnCredentialData) WebAuthnSecretData(org.keycloak.models.credential.dto.WebAuthnSecretData) IOException(java.io.IOException)

Aggregations

WebAuthnCredentialData (org.keycloak.models.credential.dto.WebAuthnCredentialData)2 WebAuthnSecretData (org.keycloak.models.credential.dto.WebAuthnSecretData)2 IOException (java.io.IOException)1