Package org.springframework.security.core.authority

Examples of org.springframework.security.core.authority.GrantedAuthorityImpl


        List<String> authorities = (List<String>)request.getAttribute(OAUTH_AUTHORITIES);
        List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();

        if (authorities != null) {
            for (String authority : authorities) {
                grantedAuthorities.add(new GrantedAuthorityImpl(authority));
            }

            Authentication auth = new AnonymousAuthenticationToken(UUID.randomUUID().toString(),
                req.getUserPrincipal(), grantedAuthorities);
View Full Code Here


    public String getRoleName() {
        return roleName;
    }

    public GrantedAuthority getGrantedAuthority() {
        return new GrantedAuthorityImpl(roleName);
    }
View Full Code Here

    //校验结果
    assertEquals(user.getLoginName(), userDetails.getUsername());
    assertEquals(user.getPassword(), userDetails.getPassword());
    assertEquals(1, userDetails.getAuthorities().size());
    assertEquals(new GrantedAuthorityImpl(auth.getPrefixedName()), userDetails.getAuthorities().iterator().next());
  }
View Full Code Here

  @Test
  public void saveUserDetailsToContext() {
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRemoteAddr("localhost");
    List<GrantedAuthority> list = Lists.newArrayList((GrantedAuthority) new GrantedAuthorityImpl("role_foo"));
    User user = new User(USER_NAME, "bar", false, false, false, false, list);

    SpringSecurityUtils.saveUserDetailsToContext(user, request);

    assertEquals(USER_NAME, SpringSecurityUtils.getCurrentUserName());
View Full Code Here

    public static SecurityContext getContext() {
      SecurityContext context = new SecurityContextImpl();

      MockHttpServletRequest request = new MockHttpServletRequest();
      request.setRemoteAddr("localhost");
      List<GrantedAuthority> list = Lists.newArrayList((GrantedAuthority) new GrantedAuthorityImpl("role_foo"));
      User user = new User(USER_NAME, "bar", false, false, false, false, list);

      UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(user, null,
          list);
      authentication.setDetails(new WebAuthenticationDetails(request));
View Full Code Here

   */
  private Set<GrantedAuthority> obtainGrantedAuthorities(User user) {
    Set<GrantedAuthority> authSet = Sets.newHashSet();
    for (Role role : user.getRoleList()) {
      for (Authority authority : role.getAuthorityList()) {
        authSet.add(new GrantedAuthorityImpl(authority.getPrefixedName()));
      }
    }
    return authSet;
  }
View Full Code Here

   */
  private Set<GrantedAuthority> obtainGrantedAuthorities(User user) {
    Set<GrantedAuthority> authSet = Sets.newHashSet();
    for (Role role : user.getRoleList()) {
      for (Authority authority : role.getAuthorityList()) {
        authSet.add(new GrantedAuthorityImpl(authority.getPrefixedName()));
      }
    }
    return authSet;
  }
View Full Code Here

    //校验结果
    assertEquals(user.getLoginName(), userDetails.getUsername());
    assertEquals(user.getPassword(), userDetails.getPassword());
    assertEquals(1, userDetails.getAuthorities().size());
    assertEquals(new GrantedAuthorityImpl(auth.getPrefixedName()), userDetails.getAuthorities().iterator().next());
  }
View Full Code Here

   */
  private GrantedAuthority[] obtainGrantedAuthorities(VgUser user) {
    Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
    for (VgRole role : user.getRoleList()) {
      for (VgAuthority authority : role.getAuthorityList()) {
        authSet.add(new GrantedAuthorityImpl(authority.getName()));
      }
    }
    return authSet.toArray(new GrantedAuthority[authSet.size()]);
  }
View Full Code Here

 
     private Set<GrantedAuthority> grantedAuthorities(VgUser user) {
          Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
          for (VgRole role : user.getRoleList()) {
              for (VgAuthority authority : role.getAuthorityList()) {
                  authSet.add(new GrantedAuthorityImpl(authority.getName()));
              }
          }
          return authSet;
      }
View Full Code Here

TOP

Related Classes of org.springframework.security.core.authority.GrantedAuthorityImpl

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.