Explorar el Código

Add Saml2MessageBinding#from

Closes gh-9515
Josh Cummings hace 4 años
padre
commit
a015b8b000

+ 14 - 0
saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/Saml2MessageBinding.java

@@ -43,4 +43,18 @@ public enum Saml2MessageBinding {
 		return this.urn;
 	}
 
+	/**
+	 * Attempt to resolve the provided algorithm name to a {@code Saml2MessageBinding}.
+	 * @param name the algorithm name
+	 * @return the resolved {@code Saml2MessageBinding}, or {@code null} if not found
+	 * @since 5.5
+	 */
+	public static Saml2MessageBinding from(String name) {
+		for (Saml2MessageBinding value : values()) {
+			if (value.getUrn().equals(name)) {
+				return value;
+			}
+		}
+		return null;
+	}
 }