예제 #1
0
 /**
  * Gets assertion consumer service for.
  *
  * @param authnRequest the authn request
  * @return the assertion consumer service for
  */
 public static AssertionConsumerService getAssertionConsumerServiceFor(
     final AuthnRequest authnRequest) {
   final AssertionConsumerService acs = new AssertionConsumerServiceBuilder().buildObject();
   acs.setBinding(authnRequest.getProtocolBinding());
   acs.setLocation(authnRequest.getAssertionConsumerServiceURL());
   acs.setResponseLocation(authnRequest.getAssertionConsumerServiceURL());
   return acs;
 }
  /** {@inheritDoc} */
  @Test
  public void testSingleElementOptionalAttributesUnmarshall() {
    AuthnRequest req = (AuthnRequest) unmarshallElement(singleElementOptionalAttributesFile);

    Assert.assertEquals(
        req.isForceAuthnXSBoolean(),
        expectedForceAuthn,
        "Unmarshalled ForceAuthn was not the expected value");
    Assert.assertEquals(
        req.isPassiveXSBoolean(),
        expectedIsPassive,
        "Unmarshalled IsPassive was not the expected value");
    Assert.assertEquals(
        req.getProtocolBinding(),
        expectedProtocolBinding,
        "Unmarshalled ProtocolBinding was not the expected value");
    Assert.assertEquals(
        req.getAssertionConsumerServiceIndex(),
        expectedAssertionConsumerServiceIndex,
        "Unmarshalled AssertionConsumerServiceIndex was not the expected value");
    Assert.assertEquals(
        req.getAssertionConsumerServiceURL(),
        expectedAssertionConsumerServiceURL,
        "Unmarshalled AssertionConsumerServiceURL was not the expected value");
    Assert.assertEquals(
        req.getAttributeConsumingServiceIndex(),
        expectedAttributeConsumingServiceIndex,
        "Unmarshalled AttributeConsumingServiceIndex was not the expected value");
    Assert.assertEquals(
        req.getProviderName(),
        expectedProviderName,
        "Unmarshalled ProviderName was not the expected value");

    super.helperTestSingleElementOptionalAttributesUnmarshall(req);
  }
  /** {@inheritDoc} */
  @Test
  public void testSingleElementUnmarshall() {
    AuthnRequest req = (AuthnRequest) unmarshallElement(singleElementFile);

    Assert.assertNotNull(req, "AuthnRequest was null");
    Assert.assertEquals(
        req.isForceAuthn(), Boolean.FALSE, "ForceAuthn (empty) was not default value");
    Assert.assertEquals(req.isPassive(), Boolean.FALSE, "IsPassive (empty) was not default value");
    Assert.assertNull(req.getProtocolBinding(), "ProtocolBinding was not null");
    Assert.assertNull(
        req.getAssertionConsumerServiceIndex(), "AssertionConsumerServiceIndex was not null");
    Assert.assertNull(
        req.getAssertionConsumerServiceURL(), "AssertionConsumerServiceURL was not null");
    Assert.assertNull(
        req.getAttributeConsumingServiceIndex(), "AttributeConsumingServiceIndex was not null");
    Assert.assertNull(req.getProviderName(), "ProviderName was not null");

    super.helperTestSingleElementUnmarshall(req);
  }