Skip to content

Commit c1b5e0c

Browse files
committed
Add JavaDoc for Authenticator*ExtensionOutputs.fromAuthenticatorData
1 parent bce2e25 commit c1b5e0c

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

webauthn-server-core/src/main/java/com/yubico/webauthn/data/AuthenticatorAssertionExtensionOutputs.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,36 @@ private AuthenticatorAssertionExtensionOutputs(
6868
this.uvm = uvm == null ? null : CollectionUtil.immutableList(uvm);
6969
}
7070

71+
/**
72+
* Parse <a
73+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authentication-extension">authentication</a>
74+
* <a
75+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">authenticator
76+
* extension outputs</a> from the given authenticator data.
77+
*
78+
* <p>If the <code>authData</code> does not contain authenticator extension outputs, this returns
79+
* an empty {@link Optional}.
80+
*
81+
* <p>Otherwise, this returns a present {@link Optional} containing an {@link
82+
* AuthenticatorAssertionExtensionOutputs} value with all validly-formatted <a
83+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authentication-extension">authentication</a>
84+
* <a
85+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">extension
86+
* outputs</a> supported by this library. This silently ignores <a
87+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#registration-extension">registration</a>
88+
* extension outputs, malformed extension outputs, and unsupported extensions. The raw set of
89+
* extension outputs can instead be obtained via {@link AuthenticatorData#getExtensions()}.
90+
*
91+
* <p>Note that a present {@link AuthenticatorAssertionExtensionOutputs} may contain zero
92+
* extension outputs.
93+
*
94+
* @param authData the <a
95+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-data">authenticator
96+
* data</a> to parse extension outputs from
97+
* @return an empty {@link Optional} if the <code>authData</code> does not contain authenticator
98+
* extension outputs. Otherwise a present {@link Optional} containing parsed extension output
99+
* values.
100+
*/
71101
public static Optional<AuthenticatorAssertionExtensionOutputs> fromAuthenticatorData(
72102
AuthenticatorData authData) {
73103
return authData.getExtensions().flatMap(AuthenticatorAssertionExtensionOutputs::fromCbor);

webauthn-server-core/src/main/java/com/yubico/webauthn/data/AuthenticatorRegistrationExtensionOutputs.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,36 @@ private AuthenticatorRegistrationExtensionOutputs(
6969
this.uvm = uvm == null ? null : CollectionUtil.immutableList(uvm);
7070
}
7171

72+
/**
73+
* Parse <a
74+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#registration-extension">registration</a>
75+
* <a
76+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">authenticator
77+
* extension outputs</a> from the given authenticator data.
78+
*
79+
* <p>If the <code>authData</code> does not contain authenticator extension outputs, this returns
80+
* an empty {@link Optional}.
81+
*
82+
* <p>Otherwise, this returns a present {@link Optional} containing an {@link
83+
* AuthenticatorRegistrationExtensionOutputs} value with all validly-formatted <a
84+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#registration-extension">registration</a>
85+
* <a
86+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">extension
87+
* outputs</a> supported by this library. This silently ignores <a
88+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authentication-extension">authentication</a>
89+
* extension outputs, malformed extension outputs, and unsupported extensions. The raw set of
90+
* extension outputs can instead be obtained via {@link AuthenticatorData#getExtensions()}.
91+
*
92+
* <p>Note that a present {@link AuthenticatorRegistrationExtensionOutputs} may contain zero
93+
* extension outputs.
94+
*
95+
* @param authData the <a
96+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-data">authenticator
97+
* data</a> to parse extension outputs from
98+
* @return an empty {@link Optional} if the <code>authData</code> does not contain authenticator
99+
* extension outputs. Otherwise a present {@link Optional} containing parsed extension output
100+
* values.
101+
*/
72102
public static Optional<AuthenticatorRegistrationExtensionOutputs> fromAuthenticatorData(
73103
AuthenticatorData authData) {
74104
return authData.getExtensions().flatMap(AuthenticatorRegistrationExtensionOutputs::fromCbor);

0 commit comments

Comments
 (0)