Package org.xulfactory.gliese.message

Examples of org.xulfactory.gliese.message.UserAuthFailureMessage


  @Test
  public void shouldNotAuthenticateWithPassword() throws Exception
  {
    // Given
    UserAuthFailureMessage uafm = new UserAuthFailureMessage();
    when(transport.readMessage("password")).thenReturn(uafm);
    // When
    AuthenticationResult res = authMgr.authenticate("user", "password".toCharArray());
    // Then
    assertFalse("Authentication should not succeed", res.isSuccess());
View Full Code Here


 
  @Test
  public void shouldCorrectlyHandleTheAuthenticationMethods() throws Exception
  {
    // Given
    UserAuthFailureMessage uafm = new UserAuthFailureMessage();
    uafm.setAuthenticationsThatCanContinue(new String[] {"publickey"});
    when(transport.readMessage(anyString())).thenReturn(uafm);
    // When
    String[] methods = authMgr.getAuthenticationMethods("user");
    // Then
    assertEquals(1, methods.length);
View Full Code Here

 
  @Test
  public void shouldGenerateFailureAuthenticationResult() throws Exception
  {
    // Given
    UserAuthFailureMessage uafm = new UserAuthFailureMessage();
    // When
    AuthenticationResult result = authMgr.generateFailure(uafm);
    // Then
    assertFalse("Result should not be success", result.isSuccess());
  }
View Full Code Here

    Signature signature = Signature.getInstance("SHA1withRSA");
    signature.initSign(kp.getPrivate());
    final SSHPublicKey pkey = new SSHRSAPublicKey(
        ((RSAPublicKey)kp.getPublic()).getModulus(),
        ((RSAPublicKey)kp.getPublic()).getPublicExponent());
    UserAuthFailureMessage uafm = new UserAuthFailureMessage();
    when(transport.readMessage("publickey")).thenReturn(uafm);
    when(transport.getSessionId()).thenReturn(new byte[20]);
    // When
    AuthenticationResult res = authMgr.authenticate("user", pkey, signature);
    // Then
View Full Code Here

TOP

Related Classes of org.xulfactory.gliese.message.UserAuthFailureMessage

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.