/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.security.saml2.provider.service.registration;

/**
 * The type of bindings that messages are exchanged using Supported bindings are
 * {@code urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST} and
 * {@code urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect}. In addition there is
 * support for {@code urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect} with an XML
 * signature in the message rather than query parameters.
 * @since 5.3
 */
public enum Saml2MessageBinding {

	POST("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"), REDIRECT(
			"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect");

	private final String urn;

	Saml2MessageBinding(String s) {
		this.urn = s;
	}

	/**
	 * Returns the URN value from the SAML 2 specification for this binding.
	 * @return URN value representing this binding
	 */
	public String getUrn() {
		return this.urn;
	}

}

@@ -1507,10 +1507,423 @@
 rn;%0A%09%7D%0A%0A
+%09/**%0A%09 * Attempt to resolve the provided algorithm name to a %7B@code Saml2MessageBinding%7D.%0A%09 * @param name the algorithm name%0A%09 * @return the resolved %7B@code Saml2MessageBinding%7D, or %7B@code null%7D if not found%0A%09 * @since 5.5%0A%09 */%0A%09public static Saml2MessageBinding from(String name) %7B%0A%09%09for (Saml2MessageBinding value : values()) %7B%0A%09%09%09if (value.getUrn().equals(name)) %7B%0A%09%09%09%09return value;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A
 %7D%0A

Add Saml2MessageBinding#from