1 23 24 package com.rift.coad.lib.security; 25 26 import org.apache.log4j.Logger; 28 29 30 35 public class Validator { 36 37 private static Logger log = 39 Logger.getLogger(Validator.class.getName()); 40 41 50 public static void validate(Class ref,String roleName) throws 51 AuthorizationException, SecurityException { 52 log.debug("Validate access to : " + roleName); 53 ThreadPermissionSession session = 54 SessionManager.getInstance().getSession(); 55 Role role = RoleManager.getInstance().getRole(roleName); 56 if (role.canAccessRole(session.getPrincipals()) == false) { 57 throw new AuthorizationException("Access Denied to [" + 58 ref.getName() + "] and role [" + roleName + "]"); 59 } 60 } 61 62 } 63 | Popular Tags |