Package com.yubico.webauthn.data
Class PublicKeyCredential<A extends AuthenticatorResponse,B extends ClientExtensionOutputs>
- java.lang.Object
-
- com.yubico.webauthn.data.PublicKeyCredential<A,B>
-
public final class PublicKeyCredential<A extends AuthenticatorResponse,B extends ClientExtensionOutputs> extends java.lang.ObjectThe PublicKeyCredential interface inherits from Credential [CREDENTIAL-MANAGEMENT-1], and contains the attributes that are returned to the caller when a new credential is created, or a new assertion is requested.- See Also:
- §5.1. PublicKeyCredential Interface
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPublicKeyCredential.PublicKeyCredentialBuilder<A extends AuthenticatorResponse,B extends ClientExtensionOutputs>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <A extends AuthenticatorResponse,B extends ClientExtensionOutputs>
PublicKeyCredential.PublicKeyCredentialBuilder.MandatoryStagesbuilder()booleanequals(java.lang.Object o)BgetClientExtensionResults()A map containing extension identifier → client extension output entries produced by the extension’s client extension processing.@NonNull ByteArraygetId()The raw Credential ID of this credential, corresponding to therawIdattribute in the WebAuthn API.AgetResponse()The authenticator's response to the client’s request to either create a public key credential, or generate an authentication assertion.@NonNull PublicKeyCredentialTypegetType()ThePublicKeyCredential's type value is the string "public-key".inthashCode()static PublicKeyCredential<AuthenticatorAssertionResponse,ClientAssertionExtensionOutputs>parseAssertionResponseJson(java.lang.String json)Parse aPublicKeyCredentialobject from JSON.static PublicKeyCredential<AuthenticatorAttestationResponse,ClientRegistrationExtensionOutputs>parseRegistrationResponseJson(java.lang.String json)Parse aPublicKeyCredentialobject from JSON.PublicKeyCredential.PublicKeyCredentialBuilder<A,B>toBuilder()java.lang.StringtoString()
-
-
-
Method Detail
-
builder
public static <A extends AuthenticatorResponse,B extends ClientExtensionOutputs> PublicKeyCredential.PublicKeyCredentialBuilder.MandatoryStages builder()
-
parseRegistrationResponseJson
public static PublicKeyCredential<AuthenticatorAttestationResponse,ClientRegistrationExtensionOutputs> parseRegistrationResponseJson(java.lang.String json) throws java.io.IOException
Parse aPublicKeyCredentialobject from JSON.The
jsonshould be of the following format:{ "id": "(resp.id)", "response": { "attestationObject": "(Base64Url encoded resp.attestationObject)", "clientDataJSON": "(Base64Url encoded resp.clientDataJSON)" }, "clientExtensionResults": { (resp.getClientExtensionResults()) }, "type": "public-key" }- resp:
- The PublicKeyCredential object returned from a registration ceremony.
- id:
- The string value of
resp.id - response.attestationObject:
- The value of
resp.attestationObject, Base64Url encoded as a string - response.clientDataJSON:
- The value of
resp.clientDataJSON, Base64Url encoded as a string - clientExtensionResults:
- The return value of
resp.getClientExtensionResults() - type:
- The literal string value
"public-key"
- Parameters:
json- a JSON string of the above format- Throws:
java.io.IOException- if thejsonis invalid or cannot be decoded as aPublicKeyCredential
-
parseAssertionResponseJson
public static PublicKeyCredential<AuthenticatorAssertionResponse,ClientAssertionExtensionOutputs> parseAssertionResponseJson(java.lang.String json) throws java.io.IOException
Parse aPublicKeyCredentialobject from JSON.The
jsonshould be of the following format:{ "id": "(resp.id)", "response": { "authenticatorData": "(Base64Url encoded resp.authenticatorData)", "signature": "(Base64Url encoded resp.signature)", "clientDataJSON": "(Base64Url encoded resp.clientDataJSON)", "userHandle": "(null, undefined or Base64Url encoded resp.userHandle)" }, "clientExtensionResults": { (resp.getClientExtensionResults()) }, "type": "public-key" }- resp:
- The PublicKeyCredential object returned from an authentication ceremony.
- id:
- The string value of
resp.id - response.authenticatorData:
- The value of
resp.authenticatorData, Base64Url encoded as a string - response.signature:
- The value of
resp.signature, Base64Url encoded as a string - response.clientDataJSON:
- The value of
resp.clientDataJSON, Base64Url encoded as a string - response.userHandle:
- The value of
resp.userHandleBase64Url encoded as a string if present, otherwisenullorundefined - clientExtensionResults:
- The return value of
resp.getClientExtensionResults() - type:
- The literal string value
"public-key"
- Parameters:
json- a JSON string of the above format- Throws:
java.io.IOException- if thejsonis invalid or cannot be decoded as aPublicKeyCredential
-
toBuilder
public PublicKeyCredential.PublicKeyCredentialBuilder<A,B> toBuilder()
-
getId
@NonNull public @NonNull ByteArray getId()
The raw Credential ID of this credential, corresponding to therawIdattribute in the WebAuthn API.
-
getResponse
@NonNull public A getResponse()
The authenticator's response to the client’s request to either create a public key credential, or generate an authentication assertion.If the
PublicKeyCredentialwas created in response tonavigator.credentials.create(), this attribute’s value will be anAuthenticatorAttestationResponse, otherwise, thePublicKeyCredentialwas created in response tonavigator.credentials.get(), and this attribute’s value will be anAuthenticatorAssertionResponse.
-
getClientExtensionResults
@NonNull public B getClientExtensionResults()
A map containing extension identifier → client extension output entries produced by the extension’s client extension processing.
-
getType
@NonNull public @NonNull PublicKeyCredentialType getType()
ThePublicKeyCredential's type value is the string "public-key".
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-