Package org.springframework.security.context

Examples of org.springframework.security.context.SecurityContextImpl


                username,
                new GrantedAuthority[] {
                        new GrantedAuthorityImpl("ROLE_TELLER"),
                        new GrantedAuthorityImpl("ROLE_PERMISSION_LIST") });

        SecurityContext secureContext = new SecurityContextImpl();
        secureContext.setAuthentication(auth);
        SecurityContextHolder.setContext(secureContext);

    }
View Full Code Here


    /**
     * Removed the Acegi SecureContext from the ContextHolder
     */
    private void destroySecureContext() {
        SecurityContextHolder.setContext(new SecurityContextImpl());
    }
View Full Code Here

                username,
                new GrantedAuthority[] {
                        new GrantedAuthorityImpl("ROLE_TELLER"),
                        new GrantedAuthorityImpl("ROLE_PERMISSION_LIST") });

        SecurityContext secureContext = new SecurityContextImpl();
        secureContext.setAuthentication(auth);
        SecurityContextHolder.setContext(secureContext);

    }
View Full Code Here

    /**
     * Removed the Acegi SecureContext from the ContextHolder
     */
    private void destroySecureContext() {
        SecurityContextHolder.setContext(new SecurityContextImpl());
    }
View Full Code Here

            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);

            String path = redirectField.getValue();
            if (StringUtils.isNotBlank(path)) {
                setRedirect(path);
View Full Code Here

      // we want this
    }
  }

  private void configureSecurityContext() {
    SecurityContext sc = new SecurityContextImpl();
    sc.setAuthentication(getAuthentication());
    SecurityContextHolder.setContext(sc);
  }
View Full Code Here

    Authentication authentication = new UsernamePasswordAuthenticationToken(userName, password);
    try {
      authentication = authenticationManager.authenticate(authentication);
      if (authentication.isAuthenticated()) {
        // Set the security context
        SecurityContext securityContext = new SecurityContextImpl();
        securityContext.setAuthentication(authentication);
        SecurityContextHolder.setContext(securityContext);
      } else {
        throw new RuntimeException("Invalid credentials."); //$NON-NLS-1$
      }
    } catch (AuthenticationException e) {
View Full Code Here

            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);

            String path = redirectField.getValue();
            if (StringUtils.isNotBlank(path)) {
                setRedirect(path);
View Full Code Here

    public GeoServerApplication getGeoServerApplication(){
        return GeoServerApplication.get();
    }

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

            )
        );
    }

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

TOP

Related Classes of org.springframework.security.context.SecurityContextImpl

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.