Package org.acegisecurity.providers

Examples of org.acegisecurity.providers.UsernamePasswordAuthenticationToken


      LOGGER.info("Attempting to authenticate via OpenPlans cookie");
            username = pair[0];
            password = pair[1];

            if (authenticationIsRequired(username)) {
                UsernamePasswordAuthenticationToken authRequest =
                        new UsernamePasswordAuthenticationToken(username, password);
                authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));

                Authentication authResult;

                try {
                    authResult = authenticationManager.authenticate(authRequest);
View Full Code Here


    secret = tempSecret;
  }
 
  public Authentication authenticate(Authentication arg0)
      throws AuthenticationException {
    UsernamePasswordAuthenticationToken auth = (UsernamePasswordAuthenticationToken)arg0;

        String token = (auth.getCredentials() == null ? "" : auth.getCredentials().toString());
   
        if (token.length() > 40)
            token = token.substring(0, 40)
            // the token is expected to be 40 characters, this may change depending on the hash function used
            // the truncating is only needed to deal with weird garbage characters added by tomcat
       
        LOGGER.info("input:" + token);

    if (getAuth(auth.getName()).equals(token)) {
      return createNewAuthentication(auth);
    }
   
    throw new BadCredentialsException("something went wrong");
  }
View Full Code Here

           i < ga.length;
           i++){
             ga[i] = new GrantedAuthorityImpl((String)iter.next());
           }

    UsernamePasswordAuthenticationToken upat =
      new UsernamePasswordAuthenticationToken(
          new User(auth.getName(),
            (auth.getCredentials() == null ? null : auth.getCredentials().toString()),
            true,
            true,
            true,
View Full Code Here

    }

    public void login(){
        SecurityContextHolder.setContext(new SecurityContextImpl());
        SecurityContextHolder.getContext().setAuthentication(
            new UsernamePasswordAuthenticationToken(
            "admin",
            "geoserver",
            new GrantedAuthority[]{
                new GrantedAuthorityImpl("ROLE_ADMINISTRATOR")
            }
View Full Code Here

    }

    public void logout(){
        SecurityContextHolder.setContext(new SecurityContextImpl());
        SecurityContextHolder.getContext().setAuthentication(
            new UsernamePasswordAuthenticationToken(
            "anonymousUser",
            "",
            new GrantedAuthority[]{
                new GrantedAuthorityImpl("ROLE_ANONYMOUS")
            }
View Full Code Here

        if (StringUtil.isNotNullOrEmpty(username)) {
            username = username.trim();
        }
        String password = obtainPassword(request);
        String errorMessage = "";
        UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);

        if (StringUtil.isNullOrEmpty(username)) {
            errorMessage = "loginErrorMessage1.Label";
        }
        else if (StringUtil.isNullOrEmpty(password)) {
View Full Code Here

    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();

    Authentication authentication = new UsernamePasswordAuthenticationToken(
        "max", "max");
    Authentication authenticated = _dao.authenticate(authentication);
    assertNotNull(authenticated);
    GrantedAuthority[] authorities = authenticated.getAuthorities();
    assertNotNull(authorities);
View Full Code Here

    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();

    Authentication authentication = new UsernamePasswordAuthenticationToken(
        "pippo", "pippo");
    Authentication authenticated = _dao.authenticate(authentication);
    assertNotNull(authenticated);
    GrantedAuthority[] authorities = authenticated.getAuthorities();
    assertNotNull(authorities);
View Full Code Here

    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();

    Authentication authentication = new UsernamePasswordAuthenticationToken(
        "gargoile", "notredame");
    boolean flag = false;
    try {
      _dao.authenticate(authentication);
    } catch (BadCredentialsException e) {
View Full Code Here

        } else {
            // If password is null, set to blank to avoid a NPE.
            password = "";
        }

        UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);

        // Allow subclasses to set the "details" property
        setDetails(request, authRequest);

        // Place the last username attempted into HttpSession for views
View Full Code Here

TOP

Related Classes of org.acegisecurity.providers.UsernamePasswordAuthenticationToken

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.