[java-idp-plugin-webauthn] branch main updated: More code cleanup and Javadoc fixes
Phil Smart
philip.smart at jisc.ac.uk
Tue Dec 19 17:17:01 UTC 2023
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=b5e2be203c60d0e0699d267a14c12e2c2926baf1
The following commit(s) were added to refs/heads/main by this push:
new b5e2be2 More code cleanup and Javadoc fixes
b5e2be2 is described below
commit b5e2be203c60d0e0699d267a14c12e2c2926baf1
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Dec 19 17:16:59 2023 +0000
More code cleanup and Javadoc fixes
---
.../impl/AbstractWebAuthnRegistrationAction.java | 2 +-
.../CreatePublicKeyCredentialCreationOptions.java | 1 -
.../admin/impl/DeletePublicKeyCredential.java | 1 -
...actAuthenticatorAttestationFromFormRequest.java | 1 -
...xtractKeyRemovalInformationFromFormRequest.java | 1 -
.../webauthn/admin/impl/GenerateUserHandle.java | 1 -
.../admin/impl/StorePublicKeyCredential.java | 1 -
.../ValidateAuthenticatorAttestationResponse.java | 1 -
.../webauthn/impl/AbstractWebAuthnBaseAction.java | 2 +-
.../CreatePublicKeyCredentialRequestOptions.java | 3 ++-
...tractAuthenticatorAssertionFromFormRequest.java | 23 +++++++++++-----------
.../webauthn/impl/LookupRegisteredCredentials.java | 5 ++---
12 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnRegistrationAction.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AbstractWebAuthnRegistrationAction.java
similarity index 99%
rename from webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnRegistrationAction.java
rename to webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AbstractWebAuthnRegistrationAction.java
index c0f07fa..0b10ca0 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnRegistrationAction.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/AbstractWebAuthnRegistrationAction.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.plugin.authn.webauthn.impl;
+package net.shibboleth.idp.plugin.authn.webauthn.admin.impl;
import java.util.function.Function;
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 d35a105..b225147 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
@@ -34,7 +34,6 @@ import com.yubico.webauthn.data.PublicKeyCredentialDescriptor;
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;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
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 47de2a7..5304c04 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
@@ -29,7 +29,6 @@ import org.slf4j.Logger;
import com.yubico.webauthn.data.ByteArray;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
import net.shibboleth.shared.primitive.LoggerFactory;
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 e33a7fb..7632207 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
@@ -33,7 +33,6 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
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 fc597a2..a81b015 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
@@ -26,7 +26,6 @@ import org.slf4j.Logger;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.codec.Base64Support;
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/GenerateUserHandle.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/GenerateUserHandle.java
index 3f13598..87de061 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/GenerateUserHandle.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/GenerateUserHandle.java
@@ -30,7 +30,6 @@ import org.opensaml.profile.context.ProfileRequestContext;
import org.slf4j.Logger;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
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 246ed51..b39d5f4 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
@@ -41,7 +41,6 @@ import com.yubico.webauthn.data.UserIdentity;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnPublicKeyCredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.WebauthnPublicKeyCredentialStorageSerializer;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
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 c11ce90..0d68eca 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
@@ -32,7 +32,6 @@ import com.yubico.webauthn.data.PublicKeyCredentialCreationOptions;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.exception.RegistrationFailureException;
-import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnRegistrationAction;
import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
import net.shibboleth.shared.primitive.LoggerFactory;
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnBaseAction.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnBaseAction.java
index 13d4548..6751de8 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnBaseAction.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnBaseAction.java
@@ -52,7 +52,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
* @pre <pre>ProfileRequestContext.getSubcontext(ProfileRequestContext.class) != null</pre>
* @post <pre>AuthenticationContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
*/
-//TODO a few abstract actions, remove overlap
+//TODO a few abstract action types, remove overlap
public abstract class AbstractWebAuthnBaseAction extends AbstractProfileAction {
/** Class logger. */
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
index f8f9b1d..72129a9 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
@@ -42,7 +42,8 @@ import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
/**
- * Action to create a CreatePublicKeyCredentialRequestOptions from the parameters in the WebAuthn context.
+ * Action to create a CreatePublicKeyCredentialRequestOptions from the parameters in the WebAuthn context using the
+ * supplied {@link WebAuthnAuthenticationClient client}.
*/
public class CreatePublicKeyCredentialRequestOptions extends AbstractWebAuthnAuthenticationAction {
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java
index a3e7f10..a04da01 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java
@@ -48,28 +48,28 @@ import net.shibboleth.shared.primitive.StringSupport;
*/
public class ExtractAuthenticatorAssertionFromFormRequest extends AbstractWebAuthnAuthenticationAction {
- /** Default token code field name. */
- @Nonnull @NotEmpty public static final String DEFAULT_FIELD_NAME = "publicKeyAssertion";
+ /** Default public key assertion parameter name. */
+ @Nonnull @NotEmpty public static final String DEFAULT_PARAMETER_NAME = "publicKeyAssertion";
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(ExtractAuthenticatorAssertionFromFormRequest.class);
- /** Name of header. */
- @NonnullAfterInit @NotEmpty private String fieldName;
+ /** Name of assertion parameter. */
+ @NonnullAfterInit @NotEmpty private String assertionParameterName;
/** JSON object mapper. */
@NonnullAfterInit private ObjectMapper objectMapper;
/** Constructor. */
public ExtractAuthenticatorAssertionFromFormRequest() {
- fieldName = DEFAULT_FIELD_NAME;
+ assertionParameterName = DEFAULT_PARAMETER_NAME;
}
@Override protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
if (objectMapper == null) {
- throw new ComponentInitializationException("The objectMapper cannot be null");
+ throw new ComponentInitializationException("The object mapper cannot be null");
}
}
@@ -85,14 +85,15 @@ public class ExtractAuthenticatorAssertionFromFormRequest extends AbstractWebAut
}
/**
- * Set the name of the field to examine.
+ * Set the name of the parameter to examine.
*
* @param field field name
*/
- public void setFieldName(@Nonnull @NotEmpty final String field) {
+ public void setAssertionParameterName(@Nonnull @NotEmpty final String field) {
checkSetterPreconditions();
- fieldName = Constraint.isNotNull(StringSupport.trimOrNull(field), "Field name cannot be null or empty");
+ assertionParameterName =
+ Constraint.isNotNull(StringSupport.trimOrNull(field), "Field name cannot be null or empty");
}
@Override
@@ -113,7 +114,7 @@ public class ExtractAuthenticatorAssertionFromFormRequest extends AbstractWebAut
ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
return;
}
- log.trace("{} Authenticator assertion response: '{}'",getLogPrefix(),pkCredAssertionJson);
+ log.trace("{} Authenticator assertion response: '{}'",getLogPrefix(), pkCredAssertionJson);
try {
final PublicKeyCredential<AuthenticatorAssertionResponse, ClientAssertionExtensionOutputs> assertion =
@@ -136,7 +137,7 @@ public class ExtractAuthenticatorAssertionFromFormRequest extends AbstractWebAut
* @return the raw, unformatted, authenticator assertion response
*/
@Nullable private String extractAuthenticatorAssertionResponse(@Nonnull final HttpServletRequest httpRequest) {
- return httpRequest.getParameter(fieldName);
+ return httpRequest.getParameter(assertionParameterName);
}
}
\ No newline at end of file
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java
index d96fd2e..3126b7a 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java
@@ -28,7 +28,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
import net.shibboleth.shared.primitive.LoggerFactory;
/**
- * An action that lookups existing registered credentials.
+ * An action that lookups existing registered credentials and sets them onto the WebAuthn context.
*/
public class LookupRegisteredCredentials extends AbstractWebAuthnBaseAction {
@@ -42,14 +42,13 @@ public class LookupRegisteredCredentials extends AbstractWebAuthnBaseAction {
final String username = context.getUsername();
if (username == null) {
- log.error("Unable to find username in registration context");
+ log.error("{} Unable to find username in registration context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.INVALID_AUTHN_CTX);
return;
}
final Collection<CredentialRegistration> credentials =
getCredentialRepository().getRegistrationsByUsername(username);
-
log.debug("{} Found '{}' registered credentials for '{}'", getLogPrefix(),
credentials != null ? credentials.size() : "0", username);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list