Examples of GrantedAuthority


Examples of org.springframework.security.core.GrantedAuthority

     */
    public static boolean hasAuthority(String role, HttpSession aSession) throws CustomException {
        if (SecurityContextHolder.getContext() != null) {
            Authentication auth = SecurityContextHolder.getContext().getAuthentication();
            final Collection<? extends GrantedAuthority> authorities = auth.getAuthorities();
            final GrantedAuthority authority = new SimpleGrantedAuthority(role);
            boolean hasAuthority = authorities.contains(authority);
            if (!hasAuthority) {
                throw new CustomException(MessageFormat.format(LocaleManager.getInstance(aSession).getMessageResource(ServiceSecurityHelper.class)
                        .getString("EXCEPTION_ACCESS_DENIED_BECAUSE_OF_RIGHTS"), role));
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.