Class AssertionRequest
- java.lang.Object
-
- com.yubico.webauthn.AssertionRequest
-
public final class AssertionRequest extends java.lang.ObjectA combination of aPublicKeyCredentialRequestOptionsand, optionally, ausername.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAssertionRequest.AssertionRequestBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AssertionRequest.AssertionRequestBuilder.MandatoryStagesbuilder()booleanequals(java.lang.Object o)static AssertionRequestfromJson(java.lang.String json)Decode anAssertionRequestfrom JSON.@NonNull PublicKeyCredentialRequestOptionsgetPublicKeyCredentialRequestOptions()An object that can be serialized to JSON and passed as thepublicKeyargument tonavigator.credentials.get().java.util.Optional<java.lang.String>getUsername()The username of the user to authenticate, if the user has already been identified.inthashCode()AssertionRequest.AssertionRequestBuildertoBuilder()java.lang.StringtoCredentialsGetJson()Serialize thisAssertionRequestvalue to JSON suitable for sending to the client.java.lang.StringtoJson()Encode thisAssertionRequestto JSON.java.lang.StringtoString()
-
-
-
Method Detail
-
getUsername
public java.util.Optional<java.lang.String> getUsername()
The username of the user to authenticate, if the user has already been identified.If this is absent, this indicates that this is a request for an assertion by a client-side-resident credential, and identification of the user has been deferred until the response is received.
-
toCredentialsGetJson
public java.lang.String toCredentialsGetJson() throws com.fasterxml.jackson.core.JsonProcessingExceptionSerialize thisAssertionRequestvalue to JSON suitable for sending to the client.This is an alias of
getPublicKeyCredentialRequestOptions().toCredentialsGetJson().Any
ByteArrayvalues in this data structure will beBase64Urlencoded. Those values MUST be decoded intoBufferSourcevalues (such asUint8Array) on the client side before callingnavigator.credentials.get().After decoding binary values, the resulting JavaScript object is suitable for passing as an argument to
navigator.credentials.get().- Returns:
- a JSON value suitable for sending to the client and passing as an argument to
navigator.credentials.get(), 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.JsonProcessingExceptionEncode thisAssertionRequestto JSON. The inverse offromJson(String).This method is suitable for encoding the
AssertionRequestfor temporary storage so that it can later be passed as an argument toRelyingParty.finishAssertion(FinishAssertionOptions). ThefromJson(String)factory function is guaranteed to restore an identicalAssertionRequestinstance.Note that encoding might not be needed if you can simply keep the
AssertionRequestinstance in server memory.- Returns:
- this
AssertionRequestencoded to JSON. - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
fromJson
public static AssertionRequest fromJson(java.lang.String json) throws com.fasterxml.jackson.core.JsonProcessingException
Decode anAssertionRequestfrom JSON. The inverse oftoJson().If the JSON was generated by the
toJson()method, thenfromJson(String)in the same library version guarantees to restore an identicalAssertionRequestinstance. This is not guaranteed between different library versions.- Returns:
- a
AssertionRequestdecoded from the input JSON. - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
builder
public static AssertionRequest.AssertionRequestBuilder.MandatoryStages builder()
-
toBuilder
public AssertionRequest.AssertionRequestBuilder toBuilder()
-
getPublicKeyCredentialRequestOptions
@NonNull public @NonNull PublicKeyCredentialRequestOptions getPublicKeyCredentialRequestOptions()
An object that can be serialized to JSON and passed as thepublicKeyargument tonavigator.credentials.get().
-
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
-
-