Package javax.security.auth.login

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


            }
          }
        }
       
      });
      loginContext.login();
    } catch (LoginException e) {
      throw new RuntimeException(e);
    }
    assertTrue(true); //made it till here
    Subject subject = loginContext.getSubject();
View Full Code Here


            }
          }
        }
       
      });
      loginContext.login();
    } catch (LoginException e) {
      exceptionCatched[0] = true;
    }
    assertTrue(exceptionCatched[0]);
   
View Full Code Here

      }
    } else {
      LoginContext loginContext;
      try {
        loginContext = new LoginContext("GVS-Auth", new CookieCallbackHandler(request));
        loginContext.login();
      } catch (LoginException e) {
        /*response.setResponseStatus(ResponseStatus.FORBIDDEN);
        log.info(e);
        response.setBody(new MessageBody2Read() {
 
View Full Code Here

              }
             
            }
         
          });
          loginContext.login();
        } catch (LoginException e1) {
          // TODO Auto-generated catch block
          throw new RuntimeException(e1);
        }
       
View Full Code Here

        UserActivityLogger logger = UserActivityLogger.getInstance();
        try{
            final LoginContext loginContext =
                    new LoginContext(AuthConstants.AUTH_CONFIG_INDEX,
                            callbackHandler);
            loginContext.login();
            /*  Need this for external login modules, user is really
            authenticated after this step   */

            Set principals = loginContext.getSubject().getPrincipals();
            Object obj = null;
View Full Code Here

      String authConf = super.getResourceURL("security/auth.conf");
      getLog().debug("Using auth.conf: "+authConf);
      System.setProperty("java.security.auth.login.config", authConf);
      AppCallbackHandler handler = new AppCallbackHandler("admin", "admin".toCharArray());
      LoginContext lc = new LoginContext("testSecureHttpInvoker", handler);
      lc.login();

      // Test the secured JNDI factory
      env.setProperty(Context.PROVIDER_URL, INVOKER_BASE  + "restricted/JNDIFactory");
      getLog().debug("Creating InitialContext with env="+env);
      InitialContext ctx = new InitialContext(env);
View Full Code Here

         UsernamePasswordHandler handler = new UsernamePasswordHandler(username,
            credentials);
         Configuration conf = getConfiguration();
         // Do the JAAS login
         LoginContext lc = new LoginContext(protocol, null, handler, conf);
         lc.login();
      }
      catch(LoginException e)
      {
         AuthenticationException ex = new AuthenticationException("Failed to login using protocol="+protocol);
         ex.setRootCause(e);
View Full Code Here

         }
         UsernamePasswordHandler handler = new UsernamePasswordHandler(username,
            credentials);
         // Do the JAAS login
         LoginContext lc = new LoginContext(protocol, handler);
         lc.login();
      }
      catch(LoginException e)
      {
         AuthenticationException ex = new AuthenticationException("Failed to login using protocol="+protocol);
         ex.setRootCause(e);
View Full Code Here

   protected void startService() throws Exception
   {
      try
      {
         LoginContext lc = new LoginContext(securityDomain, callbackHandler);
         lc.login();
         this.systemSubject = lc.getSubject();
      }
      catch(Throwable t)
      {
         log.fatal("SystemAuthenticator failed, server will shutdown NOW!", t);
View Full Code Here

   public void testLdapExample1() throws Exception
   {
      System.out.println("testLdapExample1");
      UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke", "theduke".toCharArray());
      LoginContext lc = new LoginContext("testLdapExample1", handler);
      lc.login();

      Subject subject = lc.getSubject();
      System.out.println("Subject: "+subject);

      Set groups = subject.getPrincipals(Group.class);
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.