Examples of AuthenticationHandler


Examples of com.eclipsesource.jaxrs.provider.security.AuthenticationHandler

public class SecurityAdmin {

  public SecurityContext getSecurityContext( ContainerRequestContext requestContext ) {
    SecurityContext result = null;
    AuthenticationHandler authenticationHandler = Activator.getInstance().getAuthenticationHandler();
    AuthorizationHandler authorizationHandler = Activator.getInstance().getAuthorizationHandler();
    if( authenticationHandler != null && authorizationHandler != null ) {
      result = createSecurityContext( requestContext, authenticationHandler, authorizationHandler );
    }
    return result;
View Full Code Here

Examples of com.github.ebnew.ki4so.core.authentication.handlers.AuthenticationHandler

    }catch (UnsupportedCredentialsException e) {
     
    }
   
    //测试情况4,测试当认证管理器中的认证处理器列表不为null,列表有一个认证处理器,但是不支持该凭据的情况。
    AuthenticationHandler handler = Mockito.mock(AuthenticationHandler.class);
    Mockito.when(handler.supports(credential)).thenReturn(false);
    try{
      authenticationHandlers = new ArrayList<AuthenticationHandler>();
      authenticationHandlers.add(handler);
      authenticationManager.setAuthenticationHandlers(authenticationHandlers);
      authenticationManager.authenticate(credential);
      fail("当没有认证处理器应该抛出异常信息");
    }catch (UnsupportedCredentialsException e) {
     
    }
   
   
    //测试情况5,测试存在合法的认证处理器的情况,但是无合法的凭据转换器。
    handler = Mockito.mock(AuthenticationHandler.class);
    Mockito.when(handler.supports(credential)).thenReturn(true);
    Mockito.when(handler.authenticate(credential)).thenReturn(true);
    try{
      authenticationHandlers = new ArrayList<AuthenticationHandler>();
      authenticationHandlers.add(handler);
      authenticationManager.setAuthenticationHandlers(authenticationHandlers);
      authenticationManager.authenticate(credential);
      fail("当没有凭据转换器应该抛出异常信息");
    }catch (UnsupportedCredentialsException e) {
     
    }
   
   
    //测试情况6,测试存在合法的认证处理器的情况,但是凭据转换器列表不为空,但是集合中的元素为空。
    List<CredentialToPrincipalResolver> resolvers = new ArrayList<CredentialToPrincipalResolver>();
    handler = Mockito.mock(AuthenticationHandler.class);
    Mockito.when(handler.supports(credential)).thenReturn(true);
    Mockito.when(handler.authenticate(credential)).thenReturn(true);
    try{
      authenticationHandlers = new ArrayList<AuthenticationHandler>();
      authenticationHandlers.add(handler);
      authenticationManager.setAuthenticationHandlers(authenticationHandlers);
      authenticationManager.setCredentialToPrincipalResolvers(resolvers);
      authenticationManager.authenticate(credential);
      fail("当没有凭据转换器应该抛出异常信息");
    }catch (UnsupportedCredentialsException e) {
     
    }
   
    //测试情况7,测试存在合法的认证处理器的情况,但是凭据转换器列表不为空,但是集合中的元素不为空,认证后处理器对象是空。
    handler = Mockito.mock(AuthenticationHandler.class);
    Mockito.when(handler.supports(credential)).thenReturn(true);
    Mockito.when(handler.authenticate(credential)).thenReturn(true);
    CredentialToPrincipalResolver resolver = Mockito.mock(CredentialToPrincipalResolver.class);
    Principal principal = Mockito.mock(Principal.class);
    Mockito.when(resolver.supports(credential)).thenReturn(true);
    Mockito.when(resolver.resolvePrincipal(credential)).thenReturn(principal);
    try{
      authenticationHandlers = new ArrayList<AuthenticationHandler>();
      authenticationHandlers.add(handler);
      authenticationManager.setAuthenticationHandlers(authenticationHandlers);
      resolvers = new ArrayList<CredentialToPrincipalResolver>();
      resolvers.add(resolver);
      authenticationManager.setCredentialToPrincipalResolvers(resolvers);
      authenticationManager.authenticate(credential);
      fail("当没有认证后处理器应该抛出异常信息");
    }catch (NoAuthenticationPostHandlerException e) {
     
    }
   
    //测试情况8,测试存在合法的认证处理器的情况,但是凭据转换器列表不为空,但是集合中的元素不为空,认证后处理器对象不是空。
    handler = Mockito.mock(AuthenticationHandler.class);
    Mockito.when(handler.supports(credential)).thenReturn(true);
    Mockito.when(handler.authenticate(credential)).thenReturn(true);
    resolver = Mockito.mock(CredentialToPrincipalResolver.class);
    principal = Mockito.mock(Principal.class);
    Mockito.when(resolver.supports(credential)).thenReturn(true);
    Mockito.when(resolver.resolvePrincipal(credential)).thenReturn(principal);
    AuthenticationPostHandler authenticationPostHandler = Mockito.mock(AuthenticationPostHandler.class);
View Full Code Here

Examples of com.starlight.intrepid.auth.AuthenticationHandler

      thread_pool = SharedThreadPool.INSTANCE;
    }

    InetAddress server_address = setup.getServerAddress();
    Integer server_port = setup.getServerPort();
    AuthenticationHandler auth_handler = setup.getAuthHandler();
    String vmid_hint = setup.getVMIDHint();
    if ( vmid_hint == null ) {
      if ( server_address != null ) vmid_hint = server_address.getHostAddress();
      else {
        try {
View Full Code Here

Examples of com.teamdev.jxbrowser.proxy.AuthenticationHandler

    {
      proxyConf.setAutoDetectForNetwork( false );

      if( !proxyAuthenticationInitialized )
      {
        proxyConf.setAuthenticationHandler( ServerType.HTTP, new AuthenticationHandler()
        {
          @Override
          public ProxyServerLogin authenticationRequired( ServerType arg0 )
          {
            Settings settings = SoapUI.getSettings();
View Full Code Here

Examples of org.apache.hadoop.security.authentication.server.AuthenticationHandler

    Configuration httpfsConf = new Configuration(false);
    HttpFSServerWebApp server =
      new HttpFSServerWebApp(dir, dir, dir, dir, httpfsConf);
    server.setAuthority(new InetSocketAddress(InetAddress.getLocalHost(),
                                              14000));
    AuthenticationHandler handler =
      new HttpFSKerberosAuthenticationHandlerForTesting();
    try {
      server.init();
      handler.init(null);

      testNonManagementOperation(handler);
      testManagementOperationErrors(handler);
      testGetToken(handler, null);
      testGetToken(handler, "foo");
      testCancelToken(handler);
      testRenewToken(handler);

    } finally {
      if (handler != null) {
        handler.destroy();
      }
    server.destroy();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.security.authentication.server.AuthenticationHandler

    Configuration httpfsConf = new Configuration(false);
    HttpFSServerWebApp server =
      new HttpFSServerWebApp(dir, dir, dir, dir, httpfsConf);
    server.setAuthority(new InetSocketAddress(InetAddress.getLocalHost(),
                                              14000));
    AuthenticationHandler handler =
      new HttpFSKerberosAuthenticationHandlerForTesting();
    try {
      server.init();
      handler.init(null);

      testValidDelegationToken(handler);
      testInvalidDelegationToken(handler);
    } finally {
      if (handler != null) {
        handler.destroy();
      }
    server.destroy();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.security.authentication.server.AuthenticationHandler

    Configuration httpfsConf = new Configuration(false);
    HttpFSServerWebApp server =
      new HttpFSServerWebApp(dir, dir, dir, dir, httpfsConf);
    server.setAuthority(new InetSocketAddress(InetAddress.getLocalHost(),
                                              14000));
    AuthenticationHandler handler =
      new HttpFSKerberosAuthenticationHandlerForTesting();
    try {
      server.init();
      handler.init(null);

      testNonManagementOperation(handler);
      testManagementOperationErrors(handler);
      testGetToken(handler, null, expectedTokenKind);
      testGetToken(handler, "foo", expectedTokenKind);
      testCancelToken(handler);
      testRenewToken(handler);

    } finally {
      if (handler != null) {
        handler.destroy();
      }
    server.destroy();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.security.authentication.server.AuthenticationHandler

    Configuration httpfsConf = new Configuration(false);
    HttpFSServerWebApp server =
      new HttpFSServerWebApp(dir, dir, dir, dir, httpfsConf);
    server.setAuthority(new InetSocketAddress(InetAddress.getLocalHost(),
                                              14000));
    AuthenticationHandler handler =
      new HttpFSKerberosAuthenticationHandlerForTesting();
    try {
      server.init();
      handler.init(null);

      testValidDelegationToken(handler);
      testInvalidDelegationToken(handler);
    } finally {
      if (handler != null) {
        handler.destroy();
      }
    server.destroy();
    }
  }
View Full Code Here

Examples of org.apache.sling.engine.auth.AuthenticationHandler

            } else {
                final List<AuthenticationHandlerInfo> infos = new ArrayList<AuthenticationHandlerInfo>();
                for (int i = 0; i < services.length; i++) {
                    final String paths[] = OsgiUtil.toStringArray(services[i].getProperty(AuthenticationHandler.PATH_PROPERTY));
                    if ( paths != null && paths.length > 0 ) {
                        final AuthenticationHandler handler = (AuthenticationHandler) authHandlerTracker.getService(services[i]);
                        for(int m = 0; m < paths.length; m++) {
                            if ( paths[m] != null && paths[m].length() > 0 ) {
                                infos.add(new AuthenticationHandlerInfo(paths[m], handler));
                            }
                        }
View Full Code Here

Examples of org.apache.sling.engine.auth.AuthenticationHandler

                for (int i = 0; i < services.length; i++) {
                    final String paths[] = OsgiUtil.toStringArray(services[i].getProperty(AuthenticationHandler.PATH_PROPERTY));

                    if ( paths != null && paths.length > 0 ) {
                        final AuthenticationHandler handler = (AuthenticationHandler) authHandlerTracker.getService(services[i]);

                        for(int m = 0; m < paths.length; m++) {
                            if ( paths[m] != null && paths[m].length() > 0 ) {
                                String fullPath = paths[m];
                                String path = fullPath;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.