List of usage examples for org.springframework.security.core GrantedAuthority equals
public boolean equals(Object obj)
From source file:org.springmodules.validation.valang.functions.InRoleFunction.java
protected Object doGetResult(Object target) { Object role = getArguments()[0].getResult(target); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { return Boolean.FALSE; }//from w ww . j a v a 2s . c o m Collection<GrantedAuthority> authorities = authentication.getAuthorities(); for (GrantedAuthority grantedAuthority : authorities) { if (grantedAuthority.equals(role)) { return Boolean.TRUE; } } return Boolean.FALSE; }