/** * Options may have a comma separated delegate map * @param commaSeparatedDelegates */ protected void populateDelegateMap(String commaSeparatedDelegates) { StringTokenizer st = new StringTokenizer(commaSeparatedDelegates,","); while(st.hasMoreTokens()) { String keyPair = st.nextToken(); StringTokenizer keyst = new StringTokenizer(keyPair,"="); if(keyst.countTokens() != 2) throw new IllegalStateException("DelegateMap entry invalid:"+keyPair); String key = keyst.nextToken(); String value = keyst.nextToken(); this.delegateMap.put(ResourceType.valueOf(key),value); } } }
private ACLInfo getACLInfo(String domainName, Resource resource) { ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy(domainName); if (aPolicy == null) { if (trace) log.trace("Application Policy not obtained for domain=" + domainName + ". Trying to obtain the App policy for the default domain of the layer:"); aPolicy = SecurityConfiguration.getApplicationPolicy(resource.getLayer().name()); } if (aPolicy == null) throw new IllegalStateException("Application Policy is null for domain:" + domainName); return aPolicy.getAclInfo(); }
/** * Subclasses can use this method to leave the authorization * decision to the delegate configured */ protected int invokeDelegate(Resource resource) { int authorizationDecision = AuthorizationContext.DENY; ResourceType layer = resource.getLayer(); String delegateStr = (String)delegateMap.get(layer); if(delegateStr == null) throw PicketBoxMessages.MESSAGES.missingDelegateForLayer(layer != null ? layer.toString() : null); AuthorizationModuleDelegate delegate = null; try { delegate = getDelegate(delegateStr); authorizationDecision = delegate.authorize(resource,this.subject, this.role); } catch(Exception e) { IllegalStateException ise = new IllegalStateException(e.getLocalizedMessage()); ise.initCause(e); throw ise; } return authorizationDecision; }
/** * Options may have a comma separated delegate map * @param commaSeparatedDelegates */ protected void populateDelegateMap(String commaSeparatedDelegates) { StringTokenizer st = new StringTokenizer(commaSeparatedDelegates,","); while(st.hasMoreTokens()) { String keyPair = st.nextToken(); StringTokenizer keyst = new StringTokenizer(keyPair,"="); if(keyst.countTokens() != 2) throw PicketBoxMessages.MESSAGES.invalidDelegateMapEntry(keyPair); String key = keyst.nextToken(); String value = keyst.nextToken(); this.delegateMap.put(ResourceType.valueOf(key),value); } } }