[java-idp-plugin-webauthn] 01/03: Improve Javadoc

Phil Smart philip.smart at jisc.ac.uk
Fri Mar 15 10:25:24 UTC 2024


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-idp-plugin-webauthn.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=67789cd1cd3537f5ba7776e45d7ac0c0916778b0

commit 67789cd1cd3537f5ba7776e45d7ac0c0916778b0
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Mar 12 12:06:32 2024 +0000

    Improve Javadoc
---
 .../webauthn/admin/WebAuthnRegistrationEventIds.java |  3 +++
 .../impl/AddAttestationConveyancePreference.java     | 10 +++++++---
 .../impl/AddAuthenticatorAttachmentRequirement.java  |  9 ++++++---
 .../admin/impl/AddResidentKeyRequirement.java        |  5 ++++-
 .../plugin/authn/webauthn/admin/impl/AddUserId.java  | 20 ++++++++++----------
 .../CreatePublicKeyCredentialCreationOptions.java    | 17 ++++++++++-------
 .../admin/impl/DeletePublicKeyCredential.java        | 10 +++++++---
 ...tractAuthenticatorAttestationFromFormRequest.java | 13 +++++++++----
 .../ExtractKeyRemovalInformationFromFormRequest.java | 15 +++++++++------
 .../impl/PopulateWebAuthnRegistrationContext.java    |  8 +++-----
 .../admin/impl/StorePublicKeyCredential.java         |  6 ++++--
 .../ValidateAuthenticatorAttestationResponse.java    |  6 +++++-
 12 files changed, 77 insertions(+), 45 deletions(-)

diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/WebAuthnRegistrationEventIds.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/WebAuthnRegistrationEventIds.java
index cddaed6..0985ba7 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/WebAuthnRegistrationEventIds.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/WebAuthnRegistrationEventIds.java
@@ -32,5 +32,8 @@ public final class WebAuthnRegistrationEventIds {
     
     /** Registration failed. */
     @Nonnull @NotEmpty public static final String INVALID_REGISTRATION = "InvalidRegistration";
+    
+    /** Registration context is invalid. */
+    @Nonnull @NotEmpty public static final String INVALID_REGISTRATION_CTX = "InvalidRegistrationContext";
 
 }
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAttestationConveyancePreference.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAttestationConveyancePreference.java
index ac585bd..6434351 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAttestationConveyancePreference.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAttestationConveyancePreference.java
@@ -31,7 +31,11 @@ import net.shibboleth.shared.logic.ConstraintViolationException;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
- * Add a Attestation Preference to the {@link WebAuthnAuthenticationContext context}.
+ * Add a Attestation preference to the {@link WebAuthnAuthenticationContext context}. The default preference is 'none'.
+ * 
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post <pre>WebAuthnRegistrationContext.getAttestationConveyancePreference() != null</pre>
+ * 
  */
 public class AddAttestationConveyancePreference extends AbstractWebAuthnRegistrationAction {
     
@@ -47,9 +51,9 @@ public class AddAttestationConveyancePreference extends AbstractWebAuthnRegistra
     }
     
     /**
-     * Set the UserVerification requirement. 
+     * Set the attestation conveyance preference. 
      * 
-     * @param requirement The userVerificationRequirement to set.
+     * @param preference the attestation conveyance preference to set.
      */
     public void setAttestationConveyancePreference(@Nonnull @NotEmpty final String preference) {
         checkSetterPreconditions();
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAuthenticatorAttachmentRequirement.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAuthenticatorAttachmentRequirement.java
index c47e986..8e5952a 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAuthenticatorAttachmentRequirement.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddAuthenticatorAttachmentRequirement.java
@@ -31,7 +31,10 @@ import net.shibboleth.shared.logic.ConstraintViolationException;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
- * Add a ResidentKey requirement to the {@link WebAuthnRegistrationContext context}.
+ * Add an authenticator attachment requirement to the {@link WebAuthnRegistrationContext context}.
+ * 
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post <pre>WebAuthnRegistrationContext.getAuthenticatorAttachmentRequirement() != null</pre>
  */
 public class AddAuthenticatorAttachmentRequirement extends AbstractWebAuthnRegistrationAction {
     
@@ -47,9 +50,9 @@ public class AddAuthenticatorAttachmentRequirement extends AbstractWebAuthnRegis
     }
     
     /**
-     * Set the AuthenticatorAttachment requirement. 
+     * Set the authenticator attachment requirement. 
      * 
-     * @param requirement The AuthenticatorAttachment requirement to set.
+     * @param requirement The authenticator attachment requirement to set.
      */
     public void setAuthenticatorAttachmentRequirement(@Nonnull @NotEmpty final String requirement) {
         checkSetterPreconditions();
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddResidentKeyRequirement.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddResidentKeyRequirement.java
index e22d9d5..6cddc22 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddResidentKeyRequirement.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddResidentKeyRequirement.java
@@ -30,7 +30,10 @@ import net.shibboleth.shared.logic.ConstraintViolationException;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
- * Add a ResidentKey requirement to the {@link WebAuthnRegistrationContext context}.
+ * Add a ResidentKey requirement to the {@link WebAuthnRegistrationContext context}. Default is 'preferred'. 
+ * 
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post <pre>WebAuthnRegistrationContext.getResidentKeyRequirement() != null</pre>
  */
 public class AddResidentKeyRequirement extends AbstractWebAuthnRegistrationAction {
     
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddUserId.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddUserId.java
index a2f258a..f375a19 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddUserId.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AddUserId.java
@@ -26,27 +26,27 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 
 import com.yubico.webauthn.data.ByteArray;
 
-import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
 import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
 import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
- * An action to generate or lookup a user.id used as a userHandle. This is used by the IdP to map a public key credential 
- * to a users session map of public keys, and by the Authenticator to map the IdP's ID (RelyingParty ID) and the 
- * User Handle to a public key credential source (which contains the private key).
+ * An action to generate or lookup a user.id used as a userHandle. This is used by the IdP to map a public key 
+ * credential to a users session map of public keys, and by the Authenticator to map the IdP's ID (RelyingParty ID)
+ * and the userHandle to a public key credential source (which contains the private key).
  * 
- * <p>The same user should use the same UserHandle.</p>
+ * <p>Note, the same user should use the same UserHandle.</p>
  * 
- * @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
- * @event {@link org.opensaml.profile.action.EventIds#INVALID_PROFILE_CTX}
+ * @event {@link WebAuthnRegistrationEventIds#INVALID_REGISTRATION_CTX}
+ * @event {@link WebAuthnRegistrationEventIds#INVALID_REGISTRATION}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
  * @post a UserHandle is added to the registration context
  */
 public class AddUserId extends AbstractWebAuthnRegistrationAction {
@@ -89,7 +89,7 @@ public class AddUserId extends AbstractWebAuthnRegistrationAction {
         username = context.getUsername();
         if (username == null) {
             log.error("{} Username not available in registration context", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return false;
         }
         
@@ -111,7 +111,7 @@ public class AddUserId extends AbstractWebAuthnRegistrationAction {
             final byte[] userId = userIdGeneratorStrategy.apply(profileRequestContext);
             if (userId == null) {
                 log.trace("{} Generated UserID was null", getLogPrefix());
-                ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+                ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION);
                 return;
             }
             log.trace("{} Generated UserID '{}'",getLogPrefix(),userId);
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java
index ebba6d8..127b164 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java
@@ -35,6 +35,7 @@ import com.yubico.webauthn.data.ResidentKeyRequirement;
 import com.yubico.webauthn.data.UserVerificationRequirement;
 
 import net.shibboleth.idp.plugin.authn.webauthn.admin.CredentialCreationOptionsParameters;
+import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
 import net.shibboleth.idp.plugin.authn.webauthn.client.WebAuthnAuthenticationClient;
 import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
 import net.shibboleth.idp.plugin.authn.webauthn.exception.WebAuthnAuthenticationClientException;
@@ -48,8 +49,10 @@ import net.shibboleth.shared.primitive.LoggerFactory;
  * Action to create a PublicKeyCredentialCreationOptions from the parameters in the WebAuthn context using the available
  * {@link WebAuthnAuthenticationClient client}.
  * 
- * @event {@link EventIds#INVALID_PROFILE_CTX}
+ * @event {WebAuthnRegistrationEventIds#INVALID_REGISTRATION_CTX}
  * @event {@link EventIds#IO_ERROR}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post a UserHandle is added to the registration context
  */
 public class CreatePublicKeyCredentialCreationOptions extends AbstractWebAuthnRegistrationAction {
     
@@ -87,37 +90,37 @@ public class CreatePublicKeyCredentialCreationOptions extends AbstractWebAuthnRe
         final byte[] challenge = context.getServerChallenge();
         if (challenge == null) {
             log.error("{} WebAuthn challenge is null",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         final ResidentKeyRequirement residentKeyRequirement = context.getResidentKeyRequirement();
         if (residentKeyRequirement == null) {
             log.error("{} ResidentKeyRequirement is null",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         final UserVerificationRequirement uvRequirement = context.getUserVerificationRequirement();
         if (uvRequirement == null) {
             log.error("{} UserVerificationRequirement is null",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         final String username = context.getUsername();
         if (username == null) {
             log.error("{} Username is null",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         final byte[] userId = context.getUserId();
         if (userId == null) {
             log.error("{} UserID is null",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         final AttestationConveyancePreference attestationPreference = context.getAttestationConveyancePreference();
         if (attestationPreference == null) {
             log.error("{} AttestationConveyancePreference is null",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
 
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
index 5304c04..b849c32 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
@@ -22,18 +22,22 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 
 import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 
 import com.yubico.webauthn.data.ByteArray;
 
+import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
 import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
 import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
  * An action that removes a public key credential from the credential repository.
+ * 
+ * @event {WebAuthnRegistrationEventIds#INVALID_REGISTRATION_CTX}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post a credential is removed from credential repository
  */
 public class DeletePublicKeyCredential extends AbstractWebAuthnRegistrationAction {
 
@@ -48,14 +52,14 @@ public class DeletePublicKeyCredential extends AbstractWebAuthnRegistrationActio
         final String username = context.getUsername();
         if (username == null) {
             log.error("{} Unable to find username in registration context", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         
         final byte[] credentialId = context.getCredentialIdToRemove();
         if (credentialId == null) {
             log.error("{} Unable to find credentialId in registration context", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext,  EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext,  WebAuthnRegistrationEventIds.INVALID_REGISTRATION_CTX);
             return;
         }
         
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractAuthenticatorAttestationFromFormRequest.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractAuthenticatorAttestationFromFormRequest.java
index 7632207..cdd8803 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractAuthenticatorAttestationFromFormRequest.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractAuthenticatorAttestationFromFormRequest.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import javax.annotation.Nonnull;
 
 import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 
@@ -32,6 +31,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
 
 import jakarta.servlet.http.HttpServletRequest;
 import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
 import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.logic.Constraint;
@@ -42,6 +42,11 @@ import net.shibboleth.shared.primitive.StringSupport;
 /**
  * An action that extracts the Authenticator Attestation Response and credential Nickname from the incoming
  * HTTP request.
+ * 
+ * @event {WebAuthnRegistrationEventIds#INVALID_REGISTRATION}
+ * @event {AuthnEventIds#NO_CREDENTIALS}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post add an AuthenticatorAttestationResponse to the registration context
  */
 public class ExtractAuthenticatorAttestationFromFormRequest extends AbstractWebAuthnRegistrationAction {
 
@@ -97,14 +102,14 @@ public class ExtractAuthenticatorAttestationFromFormRequest extends AbstractWebA
         final HttpServletRequest request = getHttpServletRequest();
         if (request == null) {
             log.debug("{} Profile action does not contain an HttpServletRequest", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
             return;
         }
         
         final String pkCredAttestationJson = request.getParameter(attestationParameterName);        
         if (StringSupport.trimOrNull(pkCredAttestationJson) == null) {
             log.warn("{} No authenticator attestation response in request", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext,  AuthnEventIds.NO_CREDENTIALS);
             return;
         }
         log.trace("Public key credential authenticator attestation response in JSON is '{}'",pkCredAttestationJson);
@@ -125,7 +130,7 @@ public class ExtractAuthenticatorAttestationFromFormRequest extends AbstractWebA
             context.setCredentialNickname(credNickname);
         } catch (final IOException e) {
             log.warn("{} Could not convert AuthenticatorAttestationResponse from request parameter", getLogPrefix(), e);
-            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
+            ActionSupport.buildEvent(profileRequestContext, WebAuthnRegistrationEventIds.INVALID_REGISTRATION);
             return;
         }
     }
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractKeyRemovalInformationFromFormRequest.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractKeyRemovalInformationFromFormRequest.java
index a81b015..4e1ea6c 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractKeyRemovalInformationFromFormRequest.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractKeyRemovalInformationFromFormRequest.java
@@ -20,11 +20,11 @@ package net.shibboleth.idp.plugin.authn.webauthn.admin.impl;
 import javax.annotation.Nonnull;
 
 import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 
 import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
 import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
@@ -37,6 +37,11 @@ import net.shibboleth.shared.primitive.StringSupport;
 
 /**
  * An action that extracts the credential identifier for removal from the incoming HTTP request.
+ * 
+ * @event {AuthnEventIds#NO_CREDENTIALS}
+ * @event {EventIds#IO_ERROR}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post add credential ID to remove from the the registration context
  */
 public class ExtractKeyRemovalInformationFromFormRequest extends AbstractWebAuthnRegistrationAction {
 
@@ -73,15 +78,14 @@ public class ExtractKeyRemovalInformationFromFormRequest extends AbstractWebAuth
         final HttpServletRequest request = getHttpServletRequest();
         if (request == null) {
             log.debug("{} Profile action does not contain an HttpServletRequest", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
             return;
         }
 
         final String credentialId = request.getParameter(credentialIdParameterName);         
         if (credentialId == null) {
-            //TODO look at these eventIds
             log.debug("{} CredentialID not found in HTTP request",getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext,  EventIds.IO_ERROR);
+            ActionSupport.buildEvent(profileRequestContext,  AuthnEventIds.NO_CREDENTIALS);
             return;
         }           
         try {
@@ -90,9 +94,8 @@ public class ExtractKeyRemovalInformationFromFormRequest extends AbstractWebAuth
             context.setCredentialIdToRemove(credentialIdAsBytes); 
             log.trace("{} Credential to remove '{}'",getLogPrefix(),credentialId);
         } catch (final DecodingException e) {
-            //TODO look at these eventIds
             log.debug("{} Unable to base64 decode credentialID, can not remove credential", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.IO_ERROR);
+            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
             return;
         }
 
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContext.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContext.java
index a201063..911d065 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContext.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContext.java
@@ -32,14 +32,12 @@ import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
- * An action to create (or lookup) and populate the {@link WebAuthnRegistrationContext} 
- * with the ... FIXME appropriate for this request. 
+ * An action to create (or lookup) the {@link WebAuthnRegistrationContext} and populate 
+ * with the username found from the lookup strategy. 
  * 
  * @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
  * @event {@link org.opensaml.profile.action.EventIds#INVALID_PROFILE_CTX}
- * @event {@link net.shibboleth.idp.authn.AuthnEventIds#NO_CREDENTIALS}
- * @event {@link net.shibboleth.idp.authn.AuthnEventIds#AUTHN_EXCEPTION}
- * @post See above.
+ * @post a {@link WebAuthnRegistrationContext} is created, and the username has been populated.
  */
 public class PopulateWebAuthnRegistrationContext extends AbstractProfileAction {
     
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
index 7e29071..ce0bd73 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
@@ -46,6 +46,10 @@ import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
  * An action that stores the public key credential into the credential repository.
+ * 
+ * @event {WebAuthnRegistrationEventIds#INVALID_REGISTRATION}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
+ * @post the credential from the registration context is added to the credential repository
  */
 public class StorePublicKeyCredential extends AbstractWebAuthnRegistrationAction {
 
@@ -54,7 +58,6 @@ public class StorePublicKeyCredential extends AbstractWebAuthnRegistrationAction
 
     /** Backing service. */
     @NonnullAfterInit private StorageService storageService;    
-    
 
     /** Storage record serializer. */
     @Nonnull  private final StorageSerializer<Set<CredentialRegistration>> serializer;
@@ -105,7 +108,6 @@ public class StorePublicKeyCredential extends AbstractWebAuthnRegistrationAction
             return;
         } 
         try {
-            //TODO does userHandle come back from the attestation (registration) result. Do not think so.
             final RegisteredCredential credential = RegisteredCredential.builder()
                     .credentialId(registrationResult.getKeyId().getId())
                     .userHandle(new ByteArray(context.getUserId()))
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ValidateAuthenticatorAttestationResponse.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ValidateAuthenticatorAttestationResponse.java
index c3713b5..b7a3f58 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ValidateAuthenticatorAttestationResponse.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ValidateAuthenticatorAttestationResponse.java
@@ -36,7 +36,11 @@ import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
- * Validate the public key registration attempt. If valid store it inside the registration context.
+ * Validate the public key registration attempt by delegating to the WebAuthn client. If valid, store it inside the 
+ * registration context.
+ * 
+ * @event {WebAuthnRegistrationEventIds#INVALID_REGISTRATION}
+ * @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
  */
 public class ValidateAuthenticatorAttestationResponse extends AbstractWebAuthnRegistrationAction {
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list