All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.litsec.opensaml.saml2.metadata.build.SingleLogoutServiceBuilder Maven / Gradle / Ivy

There is a newer version: 1.4.5
Show newest version
/*
 * The opensaml-ext project is an open-source package that extends OpenSAML
 * with useful extensions and utilities.
 *
 * More details on 
 * Copyright (C) 2017 Litsec AB
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see .
 */
package se.litsec.opensaml.saml2.metadata.build;

import org.opensaml.saml.common.xml.SAMLConstants;
import org.opensaml.saml.saml2.metadata.SingleLogoutService;

import se.litsec.opensaml.core.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(String location) {
    this.object().setLocation(location);
    return this;
  }
  
  /**
   * Assigns the response location URI.
   * 
   * @param responseLocation
   *          the URI
   * @return the builder
   */
  public SingleLogoutServiceBuilder responseLocation(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(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;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy