[java-idp-plugin-webauthn] branch main updated: Externalise passkey labeller label.

Phil Smart philip.smart at jisc.ac.uk
Wed Nov 20 17:27:59 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=ebcdf50e87e82a6ea640ad0b9d63b58192af589c

The following commit(s) were added to refs/heads/main by this push:
     new ebcdf50  Externalise passkey labeller label.
ebcdf50 is described below

commit ebcdf50e87e82a6ea640ad0b9d63b58192af589c
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Nov 20 17:27:56 2024 +0000

    Externalise passkey labeller label.
---
 .../admin/impl/PasskeyCredentialLabeller.java      | 25 +++++++++++++++++-----
 .../impl/SecondFactorOnlyCredentialLabeller.java   |  2 +-
 .../conf/authn/webauthn-management-config.xml      |  3 ++-
 .../conf/authn/webauthn-registration-config.xml    |  3 ++-
 4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PasskeyCredentialLabeller.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PasskeyCredentialLabeller.java
index 65b9894..83916de 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PasskeyCredentialLabeller.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PasskeyCredentialLabeller.java
@@ -18,6 +18,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.function.BiFunction;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
 
@@ -25,7 +26,9 @@ import org.opensaml.profile.context.ProfileRequestContext;
 
 import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
 import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.logic.Constraint;
 
 /**
  * A credential labeller function that labels credentials as 'Passkey' if they are discoverable.
@@ -34,12 +37,24 @@ import net.shibboleth.shared.collection.CollectionSupport;
 public class PasskeyCredentialLabeller 
     implements BiFunction<EnhancedCredentialRecord, ProfileRequestContext, List<String>> {
     
+    /** The default label to use.*/
+    @Nonnull @NotEmpty private static final String DEFAULT_LABEL = "Passkey";
+    
+    /** The label to use.*/
+    @Nonnull @NotEmpty private String label;
+    
+    /** Constructor.**/
+    public PasskeyCredentialLabeller() {
+        label = DEFAULT_LABEL;
+    }
+    
     /**
+     * Set the label to use.
      * 
-     * Constructor.
-    **/
-    public PasskeyCredentialLabeller() {
-        super();
+     * @param labelIn The label to set.
+     */
+    public void setLabel(@Nonnull final String labelIn) {       
+        label = Constraint.isNotNull(labelIn, "label can not be null");
     }
 
     /** {@inheritDoc} */
@@ -53,7 +68,7 @@ public class PasskeyCredentialLabeller
         final List<String> labels = new ArrayList<>();
         final CredentialRecord credential = cred.getCredentialRecord();
         if (credential.isDiscoverable().isPresent() && credential.isDiscoverable().get()==Boolean.TRUE) {
-            labels.add("Passkey");
+            labels.add(label);
         }        
         return labels;
     }
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/SecondFactorOnlyCredentialLabeller.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/SecondFactorOnlyCredentialLabeller.java
index 9a98f89..577d9f9 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/SecondFactorOnlyCredentialLabeller.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/SecondFactorOnlyCredentialLabeller.java
@@ -93,7 +93,7 @@ public class SecondFactorOnlyCredentialLabeller
     /**
      * Set the label to use for second factor only credentials.
      * 
-     * @param label The label to set.
+     * @param labelIn The label to set.
      */
     public void setLabel(@Nonnull final String labelIn) {       
         label = Constraint.isNotNull(labelIn, "label can not be null");
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-management-config.xml b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-management-config.xml
index 8b205f7..ca268fb 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-management-config.xml
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-management-config.xml
@@ -19,7 +19,8 @@
             p:secondFactorOnlyAuthenticators="%{idp.authn.webauthn.authenticator.policy.secondFactorOnlyAuthenticators:null}"
             p:label="SecondFactorOnly"/>
         
-        <bean id="PasskeyCredentialLabeller" class="net.shibboleth.idp.plugin.authn.webauthn.admin.impl.PasskeyCredentialLabeller"/>
+        <bean id="PasskeyCredentialLabeller" class="net.shibboleth.idp.plugin.authn.webauthn.admin.impl.PasskeyCredentialLabeller"
+            p:label="Passkey"/>
     </util:list>
 
 </beans>
\ No newline at end of file
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-registration-config.xml b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-registration-config.xml
index 739f825..43ec927 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-registration-config.xml
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn-registration-config.xml
@@ -30,7 +30,8 @@
             p:secondFactorOnlyAuthenticators="%{idp.authn.webauthn.authenticator.policy.secondFactorOnlyAuthenticators:null}"
             p:label="SecondFactorOnly"/>
         
-        <bean id="PasskeyCredentialLabeller" class="net.shibboleth.idp.plugin.authn.webauthn.admin.impl.PasskeyCredentialLabeller"/>
+        <bean id="PasskeyCredentialLabeller" class="net.shibboleth.idp.plugin.authn.webauthn.admin.impl.PasskeyCredentialLabeller"
+            p:label="Passkey"/>
     </util:list>    
         
 

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


More information about the commits mailing list