title: SAML For Java Application Running on Tomcat
body: <p>I have a Java Application running on tomcat server. I am storing the user information in mysql table and for authentication using Java Rest service.
  Now when I land on <strong><em>customer.myapp.com</em></strong> I want to check if there is an active session in the browser for <strong><em>customer.com</em></strong>, if so login to my app using that session internally . If no session then redirect the user to <strong><em>customer.com</em></strong> login portal and after login land in <strong><em>customer.myapp.com</em></strong> home page.</p>
  
  <p>How can I implement this using SAML . I have gone through the theory parts and got an idea about <strong>SP</strong>(in this case customer.myapp.com) and <strong>IdP</strong>(I assume it will the the customer's login portal customer.com) . I even downloaded the <strong>OpenSAML</strong> jar. I have no idea how the configuration is to be done. In my case I don't have any access to the IDP.</p>
  
  <pre><code>public class EMSAMLObjectBuilder {
  // Get the builder factory
  XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
  
  // Get the assertion builder based on the assertion element name
  @SuppressWarnings("unchecked")
  SAMLObjectBuilder&lt;Assertion&gt; builder = (SAMLObjectBuilder&lt;Assertion&gt;) builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
  
  // Create the assertion
  Assertion assertion = builder.buildObject();
  </code></pre>
  
  <p>}</p>
  
  <p>This is the only piece of code I could find. Any help ? </p>