Package org.jboss.soa.esb.services.security.auth

Examples of org.jboss.soa.esb.services.security.auth.AuthenticationRequest


      //No auth request, maybe it was a SAML v2 Assertion in the security header. Let's try to add it
      try
      {
        Set<SecurityInfoExtractor<String>> extractors = new HashSet<SecurityInfoExtractor<String>>();
        extractors.add( new SamlAssertionExtractor() );
        AuthenticationRequest authRequest = ExtractorUtil.extract(message.getBody().get().toString(), extractors);
        ExtractorUtil.addAuthRequestToMessage(authRequest, message);
      }
      catch( ExtractionException e )
      {
        throw new MessageDeliverException( e.getMessage(), e );
View Full Code Here


  @Test
  public void extractSecurityInfoBinarySecurityToken() throws Exception
  {
    WSSecuritySoapExtractor extractor = new WSSecuritySoapExtractor();
    SOAPMessage soap = WSTestUtil.createWithBinarySecurityToken("wsse:Base64Binary", "wsse:X509v3", WSTestUtil.getStringFromFile("cert-example.xml", getClass()));
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertTrue(authRequest.getCredentials().size() == 1 );
    assertTrue(authRequest.getCredentials().iterator().next() instanceof X509Certificate );
  }
View Full Code Here

  public void extractSecurityInfoBinarySecurityTokenNoNSPrifix() throws Exception
  {
    WSSecuritySoapExtractor extractor = new WSSecuritySoapExtractor();
    //  create the SAOPMessage with out namespace prefixes for ValueType and EncodingType
    SOAPMessage soap = WSTestUtil.createWithBinarySecurityToken("Base64Binary", "X509v3", WSTestUtil.getStringFromFile("cert-example.xml", getClass()));
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertTrue(authRequest.getCredentials().size() == 1 );
    assertTrue(authRequest.getCredentials().iterator().next() instanceof X509Certificate );
  }
View Full Code Here

  @Test
  public void extractSecurityInfoBinarySecurityTokenFromFile() throws Exception
  {
    WSSecuritySoapExtractor extractor = new WSSecuritySoapExtractor();
    SOAPMessage soap = WSTestUtil.createMessage("soap-keys-example.xml", getClass());
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertTrue(authRequest.getCredentials().size() == 1 );
    assertTrue(authRequest.getCredentials().iterator().next() instanceof X509Certificate );
  }
View Full Code Here

  {
    final String username = "Bubbles";
    final String password = "228833dkd0";
    WSSecuritySoapExtractor extractor = new WSSecuritySoapExtractor();
    SOAPMessage soap = WSTestUtil.createWithUsernameToken(username, password);
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertEquals(username, authRequest.getPrincipal().getName());
    assertTrue(authRequest.getCredentials().size() == 1 );
    assertTrue(authRequest.getCredentials().iterator().next() instanceof char[] );
  }
View Full Code Here

  public void extractSecurityInfoUsernameTokenNoUsername() throws Exception
  {
    final String password = "228833dkd0";
    WSSecuritySoapExtractor extractor = new WSSecuritySoapExtractor();
    SOAPMessage soap = WSTestUtil.createWithUsernameToken(null, password);
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertEquals(null, authRequest.getPrincipal() );
    assertTrue(authRequest.getCredentials().size() == 1 );
    assertTrue(authRequest.getCredentials().iterator().next() instanceof char[] );
  }
View Full Code Here

  public void extractSecurityInfoUsernameTokenNoPassword() throws Exception
  {
    final String username = "Bubbles";
    WSSecuritySoapExtractor extractor = new WSSecuritySoapExtractor();
    SOAPMessage soap = WSTestUtil.createWithUsernameToken(username, null);
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertEquals(username, authRequest.getPrincipal().getName());
    assertTrue(authRequest.getCredentials().size() == 0 );
  }
View Full Code Here

    public void extractAssertionFromSOAPMessage() throws Exception
    {
        final SamlSoapAssertionExtractor extractor = new SamlSoapAssertionExtractor();
        final SOAPMessage soap = WSTestUtil.createMessage("soap-saml-example.xml", getClass());

        final AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);

        assertNotNull(authRequest);
        final Set<?> credentials = authRequest.getCredentials();
        assertFalse(credentials.isEmpty());
        assertEquals(1, credentials.size());
        final Object credential = credentials.iterator().next();
        assertTrue(credential instanceof SamlCredential);
View Full Code Here

  @Test
    public void performanceExtractSecurityInfo() throws Exception
    {
        final UsernameTokenExtractor  extractor = new UsernameTokenExtractor("http://schemas.xmlsoap.org/ws/2002/04/secext");
        final String soap = createUserPassSoapString("soap-userpass-example.xml");
        AuthenticationRequest authRequest = null;
       
        // warm up
        for (int i = 0; i < 5000; i++)
        {
            authRequest = extractor.extractSecurityInfo(soap);
        }
       
        int iterations = 1000000;
        long start = System.nanoTime();
        for (int i = 0; i < iterations; i++)
        {
            authRequest = extractor.extractSecurityInfo(soap);
        }
        long duration = System.nanoTime() - start;
        System.out.println(iterations + " took : " + NANOSECONDS.toSeconds(duration) + " s");
       
        assertNotNull(authRequest);
        assertEquals( "Clark", authRequest.getPrincipal().getName());
    }
View Full Code Here

  @Test
  public void extractSecurityInfo() throws Exception
  {
    UsernameTokenExtractor  extractor = new UsernameTokenExtractor("http://schemas.xmlsoap.org/ws/2002/04/secext");
    String soap = createUserPassSoapString("soap-userpass-example.xml");
    AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
   
    assertNotNull(authRequest);
    assertEquals( "Clark", authRequest.getPrincipal().getName());
  }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.services.security.auth.AuthenticationRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.