[java-idp-plugin-webauthn] branch main updated: JWEBAUTHN-46 - the management view shows canonical username instead of the one that was searched for
Phil Smart
philip.smart at jisc.ac.uk
Mon Mar 3 09:35:16 UTC 2025
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=ab28d41b869eb274f85b9ccfe40071dc788cfe65
The following commit(s) were added to refs/heads/main by this push:
new ab28d41 JWEBAUTHN-46 - the management view shows canonical username instead of the one that was searched for
ab28d41 is described below
commit ab28d41b869eb274f85b9ccfe40071dc788cfe65
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Mar 3 09:35:13 2025 +0000
JWEBAUTHN-46 - the management view shows canonical username instead of
the one that was searched for
- add a rawSearchUsername field that captures the original username
searched for.
- change default view for rawSearchUsername
https://shibboleth.atlassian.net/browse/JWEBAUTHN-46
---
.../context/WebAuthnManagementContext.java | 34 ++++++++++++++++++++--
.../impl/ExtractUsernameSearchFromFormRequest.java | 4 ++-
.../authn/webauthn/views/webauthn-management.vm | 2 +-
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java
index 79e8d8e..5de6279 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java
@@ -34,8 +34,17 @@ public class WebAuthnManagementContext extends BaseContext {
/** Canonical principal name of the authenticated user, acting as an admin. */
@Nullable private String principalName;
- /** The username of the user to find and manage credentials for. */
- @Nullable private String searchUsername;
+ /**
+ * The username of the user to find and manage credentials for. This username will likely mutate based on subject
+ * canonicalization into the username of the user stored in the credential repository.
+ */
+ @Nullable private String searchUsername;
+
+ /**
+ * The raw username entered by the admin to search for. Is not transformed or
+ * canonicalized in anyway.
+ */
+ @Nullable private String rawSearchUsername;
/** The located set of credentials registered for the given searchUsername.*/
@Nullable @Unmodifiable @NotLive private Collection<EnhancedCredentialRecord> foundCredentials;
@@ -87,6 +96,27 @@ public class WebAuthnManagementContext extends BaseContext {
return this;
}
+ /**
+ * Gets the raw username entered by the admin to search for.
+ *
+ * @return the raw username entered by the admin
+ */
+ @Nullable public String getRawSearchUsername() {
+ return rawSearchUsername;
+ }
+
+ /**
+ * Sets the raw username entered by the admin to search for.
+ *
+ * @param name the raw username entered by the admin
+ *
+ * @return this context
+ */
+ @Nonnull public WebAuthnManagementContext setRawSearchUsername(@Nullable final String name) {
+ rawSearchUsername = name;
+ return this;
+ }
+
/**
* Set the credentials found to belong to the given searchUsername.
*
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameSearchFromFormRequest.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameSearchFromFormRequest.java
index a0aaa03..0fd459f 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameSearchFromFormRequest.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameSearchFromFormRequest.java
@@ -38,7 +38,7 @@ import net.shibboleth.shared.primitive.StringSupport;
* @event {AuthnEventIds#NO_CREDENTIALS}
* @event {EventIds#IO_ERROR}
* @pre <pre>ProfileRequestContext.getSubcontext(WebAuthnRegistrationContext.class) != null</pre>
- * @post add the parameter value to the context
+ * @post add the search parameter value to the context
*/
//TODO just make this generic? would need a consumer to set the information?
public class ExtractUsernameSearchFromFormRequest extends AbstractWebAuthnAction<WebAuthnManagementContext> {
@@ -89,6 +89,8 @@ public class ExtractUsernameSearchFromFormRequest extends AbstractWebAuthnAction
}
log.trace("{} Extracting username '{}' to manage credentials for",getLogPrefix(), parameterValue);
context.setSearchUsername(parameterValue);
+ // Also set the username to search on as the rawSearchUsername, this will not be transformed
+ context.setRawSearchUsername(parameterValue);
}
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-management.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-management.vm
index 0f81268..779921f 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-management.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-management.vm
@@ -54,7 +54,7 @@ $response.addHeader("Content-Security-Policy", "default-src 'none'; style-src 's
<p id="error_message"></p>
</div>
<div>
- <h1>#springMessageText("idp.webauthn.admin.header","Registered keys for") '$encoder.encodeForHTML($webAuthnManContext.searchUsername)'</h1>
+ <h1>#springMessageText("idp.webauthn.admin.header","Registered keys for") '$encoder.encodeForHTML($webAuthnManContext.rawSearchUsername)'</h1>
#if ($webAuthnManContext.foundCredentials)
<table>
<tr>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list