[java-idp-plugin-webauthn] branch main updated: Add raw username extraction to registration action
Phil Smart
philip.smart at jisc.ac.uk
Wed Nov 13 10:05:33 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=a2857088d95effd9d57204b040539596142fd83e
The following commit(s) were added to refs/heads/main by this push:
new a285708 Add raw username extraction to registration action
a285708 is described below
commit a2857088d95effd9d57204b040539596142fd83e
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Nov 13 10:05:29 2024 +0000
Add raw username extraction to registration action
---
.../impl/ExtractUsernameFromRegistrationForm.java | 27 +++++++++++++++++-----
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameFromRegistrationForm.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameFromRegistrationForm.java
index 4a3326f..f8e9cdf 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameFromRegistrationForm.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/ExtractUsernameFromRegistrationForm.java
@@ -109,7 +109,7 @@ public class ExtractUsernameFromRegistrationForm extends AbstractWebAuthnExtract
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- final String username = getUsernameFromForm(profileRequestContext);
+ final String username = processUsername(profileRequestContext);
if (username == null) {
log.warn("{} Unable to find username in HTTP request", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.UNKNOWN_USERNAME);
@@ -117,21 +117,36 @@ public class ExtractUsernameFromRegistrationForm extends AbstractWebAuthnExtract
}
log.trace("{} Populating username '{}' from form",getLogPrefix(), username);
webAuthnContext.setUsername(username);
+ // Set the original, unmodified username.
+ webAuthnContext.setRawUsername(getUsernameFromForm());
}
/**
* Gets the username from a form submission.
*
+ * @return the raw submitted username
+ */
+ @Nullable private String getUsernameFromForm() {
+
+ final HttpServletRequest request = getHttpServletRequest();
+ if (request != null) {
+ return request.getParameter(usernameFieldName);
+ }
+ return null;
+ }
+
+ /**
+ * Gets the username from a form submission and apply transformations to it.
+ *
* @param profileRequestContext profile request context
*
* @return submitted username, after applying any configured transforms
*/
- @Nullable private String getUsernameFromForm(@Nonnull final ProfileRequestContext profileRequestContext) {
-
- final HttpServletRequest request = getHttpServletRequest();
- if (request != null) {
- return applyTransforms(request.getParameter(usernameFieldName));
+ @Nullable private String processUsername(@Nonnull final ProfileRequestContext profileRequestContext) {
+ final String username = getUsernameFromForm();
+ if (username != null) {
+ return applyTransforms(username);
}
return null;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list