Exemplo n.º 1
0
  @Test
  public void testProcess() throws XPathExpressionException, IOException {
    manualSAMLentry.setSamlAssertion(TestUtils.SAMPLE_SAML_1_ASSERTION);
    manualSAMLentry.process(secHeader, doc, contextMock);

    assertNotNull(xpath.evaluate("//saml1:Assertion", doc, XPathConstants.NODE));
    assertEquals(
        "1", xpath.evaluate("//saml1:Assertion/@MajorVersion", doc, XPathConstants.STRING));
    assertEquals(
        "1", xpath.evaluate("//saml1:Assertion/@MinorVersion", doc, XPathConstants.STRING));
  }
Exemplo n.º 2
0
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    initXpath();

    doc = XmlUtils.parseXml(TestUtils.SAMPLE_SOAP_MESSAGE);

    secHeader = new WSSecHeader();
    secHeader.insertSecurityHeader(doc);

    manualSAMLentry = new ManualSAMLEntry();

    manualSAMLentry.init(wssEntryConfigMock, outgoingWssMock);

    when(wssEntryConfigMock.getConfiguration()).thenReturn(xmlObjectMock);
    when(contextMock.expand(TestUtils.SAMPLE_SAML_1_ASSERTION))
        .thenReturn(TestUtils.SAMPLE_SAML_1_ASSERTION);
  }