Package org.springframework.security.providers

Examples of org.springframework.security.providers.UsernamePasswordAuthenticationToken


                return true;
            }

            user = userService.createUser(fullName, email, username, password1);

            Authentication token = new UsernamePasswordAuthenticationToken(username, password1);
            Authentication result = authenticationManager.authenticate(token);
            SecurityContext securityContext = new SecurityContextImpl();
            securityContext.setAuthentication(result);
            SecurityContextHolder.setContext(securityContext);
View Full Code Here


    for ( int i = 0; i < roles.size(); i++ ) {
      grantedAuthorities[ i ] = new GrantedAuthorityImpl( roles.get( i ) );
    }

    User user = new User( principalName, "", true, true, true, true, grantedAuthorities );
    Authentication auth = new UsernamePasswordAuthenticationToken( user, null, grantedAuthorities );
    return auth;

  }
View Full Code Here

        new GrantedAuthority[]{new GrantedAuthorityImpl( sysAdminRoleName )};
    final String password = "ignored";
    UserDetails repositoryAdminUserDetails =
        new User( repositoryAdminUsername, password, true, true, true, true, repositoryAdminAuthorities );
    Authentication repositoryAdminAuthentication =
        new UsernamePasswordAuthenticationToken( repositoryAdminUserDetails, password, repositoryAdminAuthorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
    SecurityContextHolder.getContext().setAuthentication( repositoryAdminAuthentication );
  }
View Full Code Here

    for ( String roleName : roles ) {
      authList.add( new GrantedAuthorityImpl( roleName ) );
    }
    GrantedAuthority[] authorities = authList.toArray( new GrantedAuthority[0] );
    UserDetails userDetails = new User( username, password, true, true, true, true, authorities );
    Authentication auth = new UsernamePasswordAuthenticationToken( userDetails, password, authorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
    SecurityContextHolder.getContext().setAuthentication( auth );
  }
View Full Code Here

        new GrantedAuthority[]{new GrantedAuthorityImpl( sysAdminRoleName )};
    final String password = "ignored";
    UserDetails repositoryAdminUserDetails =
        new User( repositoryAdminUsername, password, true, true, true, true, repositoryAdminAuthorities );
    Authentication repositoryAdminAuthentication =
        new UsernamePasswordAuthenticationToken( repositoryAdminUserDetails, password, repositoryAdminAuthorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
    SecurityContextHolder.getContext().setAuthentication( repositoryAdminAuthentication );
  }
View Full Code Here

    for ( String roleName : roles ) {
      authList.add( new GrantedAuthorityImpl( roleName ) );
    }
    GrantedAuthority[] authorities = authList.toArray( new GrantedAuthority[0] );
    UserDetails userDetails = new User( username, password, true, true, true, true, authorities );
    Authentication auth = new UsernamePasswordAuthenticationToken( userDetails, password, authorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
    SecurityContextHolder.getContext().setAuthentication( auth );
  }
View Full Code Here

    for ( String roleName : roles ) {
      authList.add( new GrantedAuthorityImpl( roleName ) );
    }
    GrantedAuthority[] authorities = authList.toArray( new GrantedAuthority[0] );
    UserDetails userDetails = new User( username, password, true, true, true, true, authorities );
    Authentication auth = new UsernamePasswordAuthenticationToken( userDetails, password, authorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
    SecurityContextHolder.getContext().setAuthentication( auth );

    createUserHomeFolder( tenant, username );
View Full Code Here

        new GrantedAuthority[] { new GrantedAuthorityImpl( superAdminRoleName ) };
    final String password = "ignored";
    UserDetails repositoryAdminUserDetails =
        new User( repositoryAdminUsername, password, true, true, true, true, repositoryAdminAuthorities );
    Authentication repositoryAdminAuthentication =
        new UsernamePasswordAuthenticationToken( repositoryAdminUserDetails, password, repositoryAdminAuthorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
    SecurityContextHolder.getContext().setAuthentication( repositoryAdminAuthentication );
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
   */
  public void authenticate(HttpServletRequest req, String username, String password) {
    try {
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
      token.setDetails(new WebAuthenticationDetails(req));
      Authentication authentication = this.authenticationManager.authenticate(token);
      log.debug("Logging in with [{}]", authentication.getPrincipal());
      SecurityContextHolder.getContext().setAuthentication(authentication);
    }
    catch (BadCredentialsException bd) {
View Full Code Here

  /* (non-Javadoc)
   * @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
   */
  public void authenticate(HttpServletRequest req, String username, String password) {
    try {
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
      token.setDetails(new WebAuthenticationDetails(req));
      Authentication authentication = this.authenticationManager.authenticate(token);
      log.debug("Logging in with [{}]", authentication.getPrincipal());
      SecurityContextHolder.getContext().setAuthentication(authentication);
    }
    catch (BadCredentialsException bd) {
View Full Code Here

TOP

Related Classes of org.springframework.security.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.