Package com.github.ebnew.ki4so.core.authentication

Examples of com.github.ebnew.ki4so.core.authentication.Credential


   
    /**
     * 测试异常输入情况。
     */
    Assert.assertFalse(handler.authenticate(null));
    Credential credential = Mockito.mock(Credential.class);
    Assert.assertFalse(handler.authenticate(credential));
   
    /**
     * 测试解密失败抛出异常的情况。
     */
 
View Full Code Here


    Assert.assertEquals("http://test.com/hello.jsp", request.getSession().getAttribute(WebConstants.KI4SO_SERVICE_KEY_IN_SESSION));
   
    /**
     * 测试返回凭据对象的情况,且存在service参数的情况。
     */
    Credential credential = Mockito.mock(Credential.class);
    LoginResult loginResult = Mockito.mock(LoginResult.class);
    ModelAndView result = Mockito.mock(ModelAndView.class);
   
    Mockito.when(credentialResolver.resolveCredential(request)).thenReturn(credential);
    Ki4soService ki4soService = Mockito.mock(Ki4soService.class);
View Full Code Here

    //测试输入Null的情况。
    Assert.assertNull(ki4soService.login(null));
   
   
    //测试认证失败的情况。
    Credential credential = Mockito.mock(Credential.class);
    //当调用认证方法则抛出异常信息。模拟测试数据。
    AuthenticationManager authenticationManager = Mockito.mock(AuthenticationManager.class);
    this.ki4soService.setAuthenticationManager(authenticationManager);
    InvalidCredentialException exception = Mockito.mock(InvalidCredentialException.class);
    String code = "message code";
View Full Code Here

   * 测试登出的情况。
   */
  @Test
  public void testLogout(){
    //测试认证失败的情况。
    Credential credential = Mockito.mock(Credential.class);
    //当调用认证方法则抛出异常信息。模拟测试数据。
    AuthenticationManager authenticationManager = Mockito.mock(AuthenticationManager.class);
    UserLoggedStatusStore userLoggedStatusStore = Mockito.mock(UserLoggedStatusStore.class);
   
    this.ki4soService.setAuthenticationManager(authenticationManager);
View Full Code Here

    Assert.assertEquals(0, this.ki4soService.getAppList(null).size());
   
    /**
     * 测试正确参数的情况。
     */
    Credential credential = Mockito.mock(Credential.class);
    Assert.assertEquals(0, this.ki4soService.getAppList(credential).size());
   
    /**
     * 测试正确参数,但是返回值的属principal为空的情况。
     */
 
View Full Code Here

    logoutAction.setCredentialResolver(credentialResolver);
   
    Ki4soService ki4soService = Mockito.mock(Ki4soService.class);
    logoutAction.setKi4soService(ki4soService);
   
    Credential credential = Mockito.mock(Credential.class);
   
    //设置预期结果。
    Mockito.when(credentialResolver.resolveCredential(request)).thenReturn(credential);
    List<App> list = new ArrayList<App>();
    App app = new App();
View Full Code Here

    public void testResolvePrincipal() {
        //测试null情况。
        assertNull(this.resolver.resolvePrincipal(null));

        //测试不只是的用户凭据对象。
        Credential credential = Mockito.mock(Credential.class);
        assertNull(this.resolver.resolvePrincipal(credential));

        //测试正常情况。
        String userId = "test";
        EncryCredential encryCredential = new EncryCredential("ddd");
View Full Code Here

TOP

Related Classes of com.github.ebnew.ki4so.core.authentication.Credential

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.