List of usage examples for org.springframework.security.core GrantedAuthority GrantedAuthority
GrantedAuthority
From source file:rashjz.info.com.az.util.AuthoritiesConverter.java
public static Collection<GrantedAuthority> getAuthorities(Set set) { //make everyone ROLE_USER Collection<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>(); if (set == null) { GrantedAuthority grantedAuthority = new GrantedAuthority() { //anonymous inner type public String getAuthority() { return "ROLE_USER"; }/*from ww w . j a v a 2s . co m*/ }; grantedAuthorities.add(grantedAuthority); return grantedAuthorities; } else { for (Iterator<UserRoles> it = new HashSet<UserRoles>(set).iterator(); it.hasNext();) { UserRoles ur = it.next(); GrantedAuthority grantedAuthority = new GrantedAuthority() { //anonymous inner type public String getAuthority() { return "ROLE_USER"; } }; grantedAuthorities.add(grantedAuthority); } return grantedAuthorities; } }
From source file:com.tamnd2.basicwebapp.security.AccountUserDetails.java
@Override public Collection<? extends GrantedAuthority> getAuthorities() { GrantedAuthority authority = new GrantedAuthority() { @Override/*from w w w. j a v a2s . c om*/ public String getAuthority() { return "USER"; } }; ArrayList<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); authorities.add(authority); return authorities; }
From source file:org.statefulj.demo.ddd.customer.domain.CustomerSessionDetails.java
public CustomerSessionDetails(Customer customer) { this.customer = customer; this.authorities.add(new GrantedAuthority() { private static final long serialVersionUID = 1L; @Override/*from www .j a v a 2s. c o m*/ public String getAuthority() { return "USER"; } }); }
From source file:com.kopaid.example.wildfly.spring.security.UserDetailsImpl.java
@Override public Collection<? extends GrantedAuthority> getAuthorities() { return Arrays.asList(new GrantedAuthority() { @Override// w w w . jav a 2 s. c o m public String getAuthority() { return DEFAULT_ROLE; } }); }
From source file:org.callistasoftware.netcare.mvk.authentication.service.MvkPreAuthenticationServiceTest.java
private GrantedAuthority createRole(final String name) { return new GrantedAuthority() { @Override/*from w w w. j av a2s . com*/ public String getAuthority() { return name; } }; }
From source file:org.callistasoftware.netcare.core.api.impl.PatientBaseViewImpl.java
@Override public Collection<? extends GrantedAuthority> getAuthorities() { return Collections.singletonList(new GrantedAuthority() { /**//from w w w . ja v a2 s. com * */ private static final long serialVersionUID = 1L; @Override public String getAuthority() { return "PATIENT"; } }); }
From source file:org.statefulj.webapp.services.impl.UserSessionServiceImpl.java
private UserDetails getDetails(final User user) { final List<GrantedAuthority> authorities = new LinkedList<GrantedAuthority>(); authorities.add(new GrantedAuthority() { private static final long serialVersionUID = 1L; @Override/*from w ww . j av a 2s . c o m*/ public String getAuthority() { return "USER"; } }); UserDetails details = new UserDetails() { private static final long serialVersionUID = 1L; String userName = user.getEmail(); String password = user.getPassword(); boolean isEnabled = !User.DELETED.equals(user.getStateDocument().getState()); @Override public boolean isEnabled() { return isEnabled; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isAccountNonExpired() { return true; } @Override public String getUsername() { return userName; } @Override public String getPassword() { return password; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities; } }; return details; }
From source file:org.springframework.security.access.hierarchicalroles.HierarchicalRolesTestHelper.java
public static List<GrantedAuthority> createAuthorityList(final String... roles) { List<GrantedAuthority> authorities = new ArrayList<>(roles.length); for (final String role : roles) { // Use non SimpleGrantedAuthority (SEC-863) authorities.add(new GrantedAuthority() { public String getAuthority() { return role; }/*from www. ja v a 2s . c o m*/ }); } return authorities; }
From source file:sawbonadev.cafe.web.security.BasicUserDetails.java
public BasicUserDetails(User user) { Validate.notNull(user);/*from w w w. j a v a 2s .co m*/ this.user = user == null ? new User() : user; final List<Role> roles = this.user.getRoles(); for (final Role role : roles) { grantedAuthorities.add(new GrantedAuthority() { @Override public String getAuthority() { return role.getName(); } }); } }