Class PublicKeyCredentialCreationOptions
- java.lang.Object
-
- com.yubico.webauthn.data.PublicKeyCredentialCreationOptions
-
public final class PublicKeyCredentialCreationOptions extends java.lang.Object
Parameters for a call tonavigator.credentials.create()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder.MandatoryStages
builder()
boolean
equals(java.lang.Object o)
static PublicKeyCredentialCreationOptions
fromJson(java.lang.String json)
Decode anPublicKeyCredentialCreationOptions
from JSON.@NonNull AttestationConveyancePreference
getAttestation()
Intended for use by Relying Parties that wish to express their preference for attestation conveyance.java.util.Optional<AuthenticatorSelectionCriteria>
getAuthenticatorSelection()
@NonNull ByteArray
getChallenge()
A challenge intended to be used for generating the newly created credential’s attestation object.java.util.Optional<java.util.Set<PublicKeyCredentialDescriptor>>
getExcludeCredentials()
@NonNull RegistrationExtensionInputs
getExtensions()
Additional parameters requesting additional processing by the client and authenticator.@NonNull java.util.List<PublicKeyCredentialParameters>
getPubKeyCredParams()
Information about the desired properties of the credential to be created.@NonNull RelyingPartyIdentity
getRp()
Contains data about the Relying Party responsible for the request.java.util.Optional<java.lang.Long>
getTimeout()
@NonNull UserIdentity
getUser()
Contains data about the user account for which the Relying Party is requesting attestation.int
hashCode()
PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder
toBuilder()
java.lang.String
toCredentialsCreateJson()
Serialize thisPublicKeyCredentialCreationOptions
value to JSON suitable for sending to the client.java.lang.String
toJson()
Encode thisPublicKeyCredentialCreationOptions
to JSON.java.lang.String
toString()
-
-
-
Method Detail
-
toCredentialsCreateJson
public java.lang.String toCredentialsCreateJson() throws com.fasterxml.jackson.core.JsonProcessingException
Serialize thisPublicKeyCredentialCreationOptions
value to JSON suitable for sending to the client.Any
ByteArray
values in this data structure will beBase64Url
encoded. Those values MUST be decoded intoBufferSource
values (such asUint8Array
) on the client side before callingnavigator.credentials.create()
.After decoding binary values, the resulting JavaScript object is suitable for passing as an argument to
navigator.credentials.create()
.- Returns:
- a JSON value suitable for sending to the client and passing as an argument to
navigator.credentials.create()
, after decoding binary options from Base64Url strings. - Throws:
com.fasterxml.jackson.core.JsonProcessingException
- if JSON serialization fails.
-
toJson
public java.lang.String toJson() throws com.fasterxml.jackson.core.JsonProcessingException
Encode thisPublicKeyCredentialCreationOptions
to JSON. The inverse offromJson(String)
.This method is suitable for encoding the
PublicKeyCredentialCreationOptions
for temporary storage so that it can later be passed as an argument toRelyingParty.finishRegistration(FinishRegistrationOptions)
. ThefromJson(String)
factory function is guaranteed to restore an identicalPublicKeyCredentialCreationOptions
instance.Note that encoding might not be needed if you can simply keep the
PublicKeyCredentialCreationOptions
instance in server memory.- Returns:
- this
PublicKeyCredentialCreationOptions
encoded to JSON. - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
fromJson
public static PublicKeyCredentialCreationOptions fromJson(java.lang.String json) throws com.fasterxml.jackson.core.JsonProcessingException
Decode anPublicKeyCredentialCreationOptions
from JSON. The inverse oftoJson()
.If the JSON was generated by the
toJson()
method, thenfromJson(String)
in the same library version guarantees to restore an identicalPublicKeyCredentialCreationOptions
instance. This is not guaranteed between different library versions.- Returns:
- a
PublicKeyCredentialCreationOptions
decoded from the input JSON. - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getTimeout
public java.util.Optional<java.lang.Long> getTimeout()
-
getExcludeCredentials
public java.util.Optional<java.util.Set<PublicKeyCredentialDescriptor>> getExcludeCredentials()
-
getAuthenticatorSelection
public java.util.Optional<AuthenticatorSelectionCriteria> getAuthenticatorSelection()
-
builder
public static PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder.MandatoryStages builder()
-
toBuilder
public PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder toBuilder()
-
getRp
@NonNull public @NonNull RelyingPartyIdentity getRp()
Contains data about the Relying Party responsible for the request.Its value's
id
member specifies the RP ID the credential should be scoped to. If omitted, its value will be set by the client. SeeRelyingPartyIdentity
for further details.
-
getUser
@NonNull public @NonNull UserIdentity getUser()
Contains data about the user account for which the Relying Party is requesting attestation.
-
getChallenge
@NonNull public @NonNull ByteArray getChallenge()
A challenge intended to be used for generating the newly created credential’s attestation object. See the §13.1 Cryptographic Challenges security consideration.
-
getPubKeyCredParams
@NonNull public @NonNull java.util.List<PublicKeyCredentialParameters> getPubKeyCredParams()
Information about the desired properties of the credential to be created.The sequence is ordered from most preferred to least preferred. The client makes a best-effort to create the most preferred credential that it can.
-
getAttestation
@NonNull public @NonNull AttestationConveyancePreference getAttestation()
Intended for use by Relying Parties that wish to express their preference for attestation conveyance. The default isAttestationConveyancePreference.NONE
.
-
getExtensions
@NonNull public @NonNull RegistrationExtensionInputs getExtensions()
Additional parameters requesting additional processing by the client and authenticator.For example, the caller may request that only authenticators with certain capabilities be used to create the credential, or that particular information be returned in the attestation object. Some extensions are defined in §9 WebAuthn Extensions; consult the IANA "WebAuthn Extension Identifier" registry established by [WebAuthn-Registries] for an up-to-date list of registered WebAuthn Extensions.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-