se.swedenconnect.opensaml.saml2.metadata.build.SingleLogoutServiceBuilder Maven / Gradle / Ivy
/*
* Copyright 2016-2021 Sweden Connect
*
* 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
*
* http://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 se.swedenconnect.opensaml.saml2.metadata.build;
import org.opensaml.saml.common.xml.SAMLConstants;
import org.opensaml.saml.saml2.metadata.SingleLogoutService;
import se.swedenconnect.opensaml.common.builder.AbstractSAMLObjectBuilder;
/**
* A builder for {@code SingleLogoutService} elements.
*
* @author Martin Lindström ([email protected])
*/
public class SingleLogoutServiceBuilder extends AbstractSAMLObjectBuilder {
/**
* Utility method that creates a builder.
*
* @return a builder
*/
public static SingleLogoutServiceBuilder builder() {
return new SingleLogoutServiceBuilder();
}
/**
* Assigns the location URI.
*
* @param location
* the URI
* @return the builder
*/
public SingleLogoutServiceBuilder location(final String location) {
this.object().setLocation(location);
return this;
}
/**
* Assigns the response location URI.
*
* @param responseLocation
* the URI
* @return the builder
*/
public SingleLogoutServiceBuilder responseLocation(final String responseLocation) {
this.object().setResponseLocation(responseLocation);
return this;
}
/**
* Assigns the binding of the service
*
* @param binding
* the binding URI
* @return the builder
* @see #postBinding()
* @see #redirectBinding()
*/
public SingleLogoutServiceBuilder binding(final String binding) {
this.object().setBinding(binding);
return this;
}
/**
* Shortcut for assigning the SAML POST binding to the service.
*
* @return the builder
* @see #binding(String)
*/
public SingleLogoutServiceBuilder postBinding() {
this.object().setBinding(SAMLConstants.SAML2_POST_BINDING_URI);
return this;
}
/**
* Shortcut for assigning the SAML Redirect binding to the service.
*
* @return the builder
* @see #binding(String)
*/
public SingleLogoutServiceBuilder redirectBinding() {
this.object().setBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI);
return this;
}
/** {@inheritDoc} */
@Override
protected Class getObjectType() {
return SingleLogoutService.class;
}
}