Package javax.security.auth.login

Examples of javax.security.auth.login.LoginContext.login()


            catch (SecurityException ex) {
                throw new CertificateValidationCallback.CertificateValidationException(ex);
            }

            try {
                loginContext.login();
                Subject subj = loginContext.getSubject();
                if (!subj.getPrincipals().isEmpty()) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Authentication request for certificate with DN [" +
                                certificate.getSubjectX500Principal().getName() + "] successful");
View Full Code Here


        CallbackHandler handler = new ServletRequestCallbackHandler(req);
        Subject subject = new Subject();
        try
        {
            LoginContext lc = loginContextFactory.createLoginContext("sample",subject,handler);
            lc.login();

            pw.println("Principal authentication successful");
            pw.println(subject);
        }
        catch (LoginException e)
View Full Code Here

        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try
        {
            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
            LoginContext lc = new LoginContext("sample", subject, handler);
            lc.login();

            pw.println("Principal authentication successful");
            pw.println(subject);
        }
        catch (LoginException e)
View Full Code Here

        {
            Configuration config = Configuration.getInstance("JavaLoginConfig", null,
                "FelixJaasProvider");
            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
            LoginContext lc = new LoginContext("sample", subject, handler, config);
            lc.login();

            pw.println("Principal authentication successful");
            pw.println(subject);
        }
        catch (NoSuchAlgorithmException e)
View Full Code Here

        Subject subject = new Subject();
        try
        {
            LoginContext lc = new LoginContext("sample", subject, handler);
            lc.login();

            pw.println("Principal authentication successful");
            pw.println(subject);
        }
        catch (LoginException e)
View Full Code Here

        final IntermediateEJBRemote intermediate) throws Exception {
        LoginContext loginContext = null;
        try {
            if (user != null) {
                loginContext = getCLMLoginContext(user, "");
                loginContext.login();
            }

            System.out.println("-------------------------------------------------");
            System.out
                .println(String.format("* * About to perform test as %s * *\n\n", user == null ? "ConnectionUser" : user));
View Full Code Here

            final String finalUrl = url;

            try {
                lc = new LoginContext(jaasContextName, new MyCallbackHandler());

                lc.login();
                try {
                    Subject.doAs(lc.getSubject(), new PrivilegedAction() {

                        public Object run() {
                            shell.exec(finalUrl);
View Full Code Here

        if (isSecurityEnabled()) {
          login = new LoginContext(HadoopConfiguration.USER_KERBEROS_CONFIG_NAME, subject);
        } else {
          login = new LoginContext(HadoopConfiguration.SIMPLE_CONFIG_NAME, subject);
        }
        login.login();
        loginUser = new UserGroupInformation(subject);
        loginUser.setLogin(login);
        loginUser.setAuthenticationMethod(isSecurityEnabled() ?
                                          AuthenticationMethod.KERBEROS :
                                          AuthenticationMethod.SIMPLE);
View Full Code Here

    long start = 0;
    try {
      login =
        new LoginContext(HadoopConfiguration.KEYTAB_KERBEROS_CONFIG_NAME, subject);
      start = System.currentTimeMillis();
      login.login();
      metrics.loginSuccess.inc(System.currentTimeMillis() - start);
      loginUser = new UserGroupInformation(subject);
      loginUser.setLogin(login);
      loginUser.setAuthenticationMethod(AuthenticationMethod.KERBEROS);
    } catch (LoginException le) {
View Full Code Here

      //have the new credentials (pass it to the LoginContext constructor)
      login =
        new LoginContext(HadoopConfiguration.USER_KERBEROS_CONFIG_NAME,
            getSubject());
      LOG.info("Initiating re-login for " + getUserName());
      login.login();
      setLogin(login);
    } catch (LoginException le) {
      throw new IOException("Login failure for " + getUserName(), le);
    }
  }
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.