[java-opensaml] branch main updated: OSJ-467 - Add Authentication UsageType

Codeberg noreply at shibboleth.net
Wed Nov 18 16:31:20 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-opensaml.

View the commit online:
https://codeberg.org/Shibboleth/java-opensaml/commit/2824f004e48f1ea2d2e9e0d9becab43bfa10babd

The following commit(s) were added to refs/heads/main by this push:
     new 2824f004e OSJ-467 - Add Authentication UsageType
2824f004e is described below

commit 2824f004e48f1ea2d2e9e0d9becab43bfa10babd
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Wed Nov 18 11:30:11 2026 -0500

    OSJ-467 - Add Authentication UsageType
    
    https://shibboleth.atlassian.net/browse/OSJ-467
    
    Shore up use setter to flag invalid types.
---
 .../opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java
index 20599f08d..3d39cb3f9 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java
@@ -69,7 +69,15 @@ public class KeyDescriptorImpl extends AbstractXMLObject implements KeyDescripto
     /** {@inheritDoc} */
     public void setUse(@Nullable final UsageType newType) {
         if (newType != null) {
-            keyUseType = prepareForAssignment(keyUseType, newType);
+            switch (newType) {
+                case SIGNING:
+                case ENCRYPTION:
+                case UNSPECIFIED:
+                    keyUseType = prepareForAssignment(keyUseType, newType);
+                    break;
+                default:
+                    throw new IllegalArgumentException("Illegal value for use attribute: " + newType.toString());
+            }
         } else {
             keyUseType = prepareForAssignment(keyUseType, UsageType.UNSPECIFIED);
         }

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


More information about the commits mailing list