Package com.caucho.security

Examples of com.caucho.security.AbstractLogin$PrincipalEntry


      /*
        if (auth == null)
        throw new ServletException(L.l("Login needs an authenticator resource with JNDI name java:comp/env/caucho/auth"));
      */

      AbstractLogin login;

      if (_customType != null) {
        login = (AbstractLogin) _customType.newInstance();

        if (_init != null)
          _init.configure(login);
      }
      else if (_authMethod.equalsIgnoreCase("basic")) {
        BasicLogin basicLogin = new BasicLogin();
        basicLogin.setRealmName(_realmName);
        login = basicLogin;
      }
      else if (_authMethod.equalsIgnoreCase("digest")) {
        DigestLogin digestLogin = new DigestLogin();
        digestLogin.setRealmName(_realmName);
        login = digestLogin;
      }
      else if (_authMethod.equalsIgnoreCase("client-cert")) {
        ClientCertLogin certLogin = new ClientCertLogin();
        login = certLogin;
      }
      else if (_authMethod.equalsIgnoreCase("form")) {
        login = new FormLogin();

        if (_formLoginConfig == null)
          throw new ConfigException(L.l("'form' authentication requires form-login"));

        _formLoginConfig.configure(login);
      }
      else
        throw new ConfigException(L.l("'{0}' is an unknown auth-type.",
                                       _authMethod));

      if (_authenticator != null)
        login.setAuthenticator(_authenticator);

      InjectManager manager = InjectManager.create();
      InjectionTarget inject = manager.createInjectionTarget(login.getClass());
      inject.inject(login, manager.createCreationalContext(null));

      login.init();

      return login;
    } catch (Exception e) {
      throw ConfigException.create(e);
    }
View Full Code Here


      /*
        if (auth == null)
        throw new ServletException(L.l("Login needs an authenticator resource with JNDI name java:comp/env/caucho/auth"));
      */

      AbstractLogin login;

      if (_customType != null) {
        login = (AbstractLogin) _customType.newInstance();

        if (_init != null)
          _init.configure(login);
      }
      else if (_authMethod.equalsIgnoreCase("basic")) {
        BasicLogin basicLogin = new BasicLogin();
        basicLogin.setRealmName(_realmName);
        login = basicLogin;
      }
      else if (_authMethod.equalsIgnoreCase("digest")) {
        DigestLogin digestLogin = new DigestLogin();
        digestLogin.setRealmName(_realmName);
        login = digestLogin;
      }
      else if (_authMethod.equalsIgnoreCase("client-cert")) {
        ClientCertLogin certLogin = new ClientCertLogin();
        login = certLogin;
      }
      else if (_authMethod.equalsIgnoreCase("form")) {
        login = new FormLogin();

        if (_formLoginConfig == null)
          throw new ConfigException(L.l("'form' authentication requires form-login"));

        _formLoginConfig.configure(login);
      }
      else
        throw new ConfigException(L.l("'{0}' is an unknown auth-type.",
                                       _authMethod));

      if (_authenticator != null)
        login.setAuthenticator(_authenticator);

      InjectManager manager = InjectManager.create();
      InjectionTarget inject = manager.createInjectionTarget(login.getClass());
      inject.inject(login, manager.createCreationalContext(null));

      login.init();

      return login;
    } catch (Exception e) {
      throw ConfigException.create(e);
    }
View Full Code Here

TOP

Related Classes of com.caucho.security.AbstractLogin$PrincipalEntry

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.