public int hashCode() { if (cachedHashCode == 0) { cachedHashCode = getName().hashCode() ^ methodSpec.hashCode(); } return cachedHashCode; }
public int hashCode() { if (cachedHashCode == 0) { cachedHashCode = getName().hashCode() ^ methodSpec.hashCode(); } return cachedHashCode; }
public int hashCode() { if (cachedHashCode == 0) { cachedHashCode = getName().hashCode() ^ methodSpec.hashCode(); } return cachedHashCode; }
private void addEJBMethodPermission(EJBMethodPermission p) { MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == ALL_METHODS) return; if (spec.methodName == null && spec.methodInterface == null && spec.methodParams == null) { permissions.put(p.getName(), ALL_METHODS); return; } if (methods == null) { methods = new HashMap<String, HashMap<String, HashSet<String>>>(); permissions.put(p.getName(), methods); } String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (interfaces == null) { interfaces = new HashMap<String, HashSet<String>>(); methods.put(methodKey, interfaces); } String interfaceKey = (spec.methodInterface == null || spec.methodInterface.length() == 0? WILDCARD:spec.methodInterface); HashSet<String> parameters = interfaces.get(interfaceKey); if (parameters == null) { parameters = new HashSet<String>(); interfaces.put(interfaceKey, parameters); } // an empty string for a parameter spec indicates a method w/ no parameters String parametersKey = (spec.methodParams == null? WILDCARD:spec.methodParams); if (!parameters.contains(parametersKey)) { parameters.add(parametersKey); } }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
private static Permissions addToUncheckedPermissions(Permissions permissions, MethodPermission mp, EJBMethodPermission ejbmp) { if (mp.isUnchecked()) { if (permissions == null) { permissions = new Permissions(); } permissions.add(ejbmp); if (_logger.isLoggable(Level.FINE)) { _logger.fine("JACC DD conversion: EJBMethodPermission ->(" + ejbmp.getName() + " " + ejbmp.getActions() + ") is (unchecked)"); } } return permissions; }
private static Permissions addToExcludedPermissions(Permissions permissions, MethodPermission mp, EJBMethodPermission ejbmp) { if (mp.isExcluded()) { if (permissions == null) { permissions = new Permissions(); } permissions.add(ejbmp); if (_logger.isLoggable(Level.FINE)) { _logger.fine("JACC DD conversion: EJBMethodPermission ->(" + ejbmp.getName() + " " + ejbmp.getActions() + ") is (excluded)"); } } return permissions; }
private static Permissions addToExcludedPermissions(Permissions permissions, MethodPermission mp, EJBMethodPermission ejbmp) { if (mp.isExcluded()) { if (permissions == null) { permissions = new Permissions(); } permissions.add(ejbmp); if (_logger.isLoggable(Level.FINE)) { _logger.fine("JACC DD conversion: EJBMethodPermission ->(" + ejbmp.getName() + " " + ejbmp.getActions() + ") is (excluded)"); } } return permissions; }
private static Permissions addToUncheckedPermissions(Permissions permissions, MethodPermission mp, EJBMethodPermission ejbmp) { if (mp.isUnchecked()) { if (permissions == null) { permissions = new Permissions(); } permissions.add(ejbmp); if (_logger.isLoggable(Level.FINE)) { _logger.fine("JACC DD conversion: EJBMethodPermission ->(" + ejbmp.getName() + " " + ejbmp.getActions() + ") is (unchecked)"); } } return permissions; }
public boolean onPreInsert(PreInsertEvent event) { EJBMethodPermission insertPermission = new EJBMethodPermission( event.getPersister().getEntityName(), HibernatePermission.INSERT ); log.debug( "checking insert permission on: " + insertPermission.getName() ); AccessController.checkPermission(insertPermission); return super.onPreInsert(event); } }
public boolean onPreUpdate(PreUpdateEvent event) { EJBMethodPermission updatePermission = new EJBMethodPermission( event.getPersister().getEntityName(), HibernatePermission.UPDATE ); log.debug( "checking update permission on: " + updatePermission.getName() ); AccessController.checkPermission(updatePermission); return super.onPreUpdate(event); } }
public void onPreLoad(PreLoadEvent event) { EJBMethodPermission loadPermission = new EJBMethodPermission( event.getPersister().getEntityName(), HibernatePermission.READ ); log.debug( "checking load permission on: " + loadPermission.getName() ); AccessController.checkPermission(loadPermission); super.onPreLoad(event); } }
public boolean onPreDelete(PreDeleteEvent event) { EJBMethodPermission deletePermission = new EJBMethodPermission( event.getPersister().getEntityName(), HibernatePermission.DELETE ); log.debug( "checking delete permission on: " + deletePermission.getName() ); AccessController.checkPermission(deletePermission); return super.onPreDelete(event); } }