public interface PermissionResolver
PermisisonResolver
resolves a String value and converts it into a
Permission
instance.
The default WildcardPermissionResolver
should be
suitable for most purposes, which constructs WildcardPermission
objects.
However, any resolver may be configured if an application wishes to use different
Permission
implementations.
A PermissionResolver
is used by many Shiro components such as annotations, property file
configuration, URL configuration, etc. It is useful whenever a String representation of a permission is specified
and that String needs to be converted to a Permission instance before executing a security check.
Shiro chooses to support Wildcardpermission
s by default in almost all components and
we do that in the form of the WildcardPermissionResolver
. One of the nice
things about WildcardPermission
s being supported by default is that it makes it very easy to
store complex permissions in the database - and also makes it very easy to represent permissions in JSP files,
annotations, etc., where a simple string representation is useful.
Although this happens to be the Shiro default, you are of course free to provide custom
String-to-Permission conversion by providing Shiro components any instance of this interface.Modifier and Type | Method and Description |
---|---|
Permission |
resolvePermission(String permissionString)
Resolves a Permission based on the given String representation.
|
Permission resolvePermission(String permissionString)
permissionString
- the String representation of a permission.InvalidPermissionStringException
- if the permission string is not valid for this resolver.Copyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.