org.zkoss.spring.security
Class SecurityUtil

java.lang.Object
  extended by org.zkoss.spring.security.SecurityUtil

public class SecurityUtil
extends java.lang.Object

Utility class for ZK spring security.

Author:
henrichen

Constructor Summary
SecurityUtil()
           
 
Method Summary
static org.springframework.security.core.Authentication getAuthentication()
          Return the current Authentication object.
static java.lang.Object getAuthentication(java.lang.String property)
          Return the evaluated result per the given property of the current Authentication object.
static boolean isAccessible(java.lang.String hasPermission, java.lang.Object domainObject)
          Return true if the current Authentication has one of the specified permissions to the presented domain object instance.
static boolean isAllGranted(java.lang.String authorities)
          Return true if the authenticated principal is granted ALL of the roles specified in authorities.
static boolean isAnyGranted(java.lang.String authorities)
          Return true if the authenticated principal is granted ANY of the roles specified in authorities.
static boolean isNoneGranted(java.lang.String authorities)
          Return true if the authenticated principal is granted NONE of the roles specified in authorities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityUtil

public SecurityUtil()
Method Detail

isAccessible

public static boolean isAccessible(java.lang.String hasPermission,
                                   java.lang.Object domainObject)
Return true if the current Authentication has one of the specified permissions to the presented domain object instance.

Parameters:
hasPermission - A comma separated list of integers, each representing a required bit mask permission from a subclass of org.springframework.security.acl.basic.AbstractBasicAclEntry.
domainObject - The actual domain object instance for which permissions are being evaluated.
Returns:
true if current Authentication has one of the specified permission to the presented domain object instance.

isNoneGranted

public static boolean isNoneGranted(java.lang.String authorities)
Return true if the authenticated principal is granted NONE of the roles specified in authorities.

Parameters:
authorities - A comma separated list of roles which the user must have been granted NONE.
Returns:
true if the authenticated principal is granted authorities of NONE the specified roles.

isAllGranted

public static boolean isAllGranted(java.lang.String authorities)
Return true if the authenticated principal is granted ALL of the roles specified in authorities.

Parameters:
authorities - A comma separated list of roles which the user must have been granted ALL.
Returns:
true true if the authenticated principal is granted authorities of ALL the specified roles.

isAnyGranted

public static boolean isAnyGranted(java.lang.String authorities)
Return true if the authenticated principal is granted ANY of the roles specified in authorities.

Parameters:
authorities - A comma separated list of roles which the user must have been granted ANY.
Returns:
true true if the authenticated principal is granted authorities of ALL the specified roles.

getAuthentication

public static org.springframework.security.core.Authentication getAuthentication()
Return the current Authentication object.


getAuthentication

public static java.lang.Object getAuthentication(java.lang.String property)
Return the evaluated result per the given property of the current Authentication object.

Parameters:
property - Property of the Authentication object which would be evaluated. Supports nested properties. For example if the principal object is an instance of UserDetails, the property "principal.username" will return the username. Alternatively, using "name" will call getName method on the Authentication object directly.
Returns:
the evaluated result of the current Authentication object per the given property.


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.