Java Code Examples for org.apache.ws.security.handler.WSHandlerConstants#USERNAME_TOKEN

The following examples show how to use org.apache.ws.security.handler.WSHandlerConstants#USERNAME_TOKEN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 6 votes vote down vote up
@Test
public void testDigestPasswordUnauthorized() throws Exception {
    setUpService("managers", true, false);
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    try {
        echo.echo("test");
        fail("Exception expected");
    } catch (Exception ex) {
        assertEquals("Unauthorized", ex.getMessage());
    }
}
 
Example 2
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 6 votes vote down vote up
@Test
public void testDigestPasswordUnauthorized() throws Exception {
    setUpService("managers", true, false);
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    try {
        echo.echo("test");
        fail("Exception expected");
    } catch (Exception ex) {
        assertEquals("Unauthorized", ex.getMessage());
    }
}
 
Example 3
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 6 votes vote down vote up
@Test
public void testDigestPasswordUnauthorized() throws Exception {
    setUpService("managers", true, false);
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    try {
        echo.echo("test");
        fail("Exception expected");
    } catch (Exception ex) {
        assertEquals("Unauthorized", ex.getMessage());
    }
}
 
Example 4
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, false);
    String actions = WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 5
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, false);
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 6
Source File: RoundTripTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testUsernameToken() throws Exception {
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 7
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncyptedClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 8
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, false);
    String actions = WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 9
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncryptedDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 10
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, false);
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 11
Source File: RoundTripTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testUsernameToken() throws Exception {
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 12
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncyptedClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 13
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncryptedDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 14
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncryptedDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 15
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncyptedClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 16
Source File: RoundTripTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testUsernameToken() throws Exception {
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 17
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncyptedClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 18
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testClearPasswordAuthorized() throws Exception {
    setUpService("developers", false, false);
    String actions = WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 19
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncryptedDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, true);
    String actions = WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.ENCRYPT;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}
 
Example 20
Source File: UserNameTokenAuthorizationTest.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void testDigestPasswordAuthorized() throws Exception {
    setUpService("developers", true, false);
    String actions = WSHandlerConstants.ENCRYPT + " " + WSHandlerConstants.SIGNATURE + " "
                     + WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN;

    wsIn.setProperty(WSHandlerConstants.ACTION, actions);
    
    wsOut.setProperty(WSHandlerConstants.ACTION, actions);

    assertEquals("test", echo.echo("test"));
}