@groovy.transform.Trait @groovy.transform.CompileStatic trait GrailsShiroRealm extends java.lang.Object implements org.apache.shiro.realm.Realm, org.apache.shiro.authz.Authorizer, org.apache.shiro.authz.permission.PermissionResolverAware, org.apache.shiro.authc.LogoutAware
| Type | Name and description |
|---|---|
static org.slf4j.Logger |
LOG |
org.apache.shiro.authz.permission.PermissionResolver |
permissionResolver |
java.lang.Class |
tokenClass |
| Type Params | Return Type | Name and description |
|---|---|---|
|
org.apache.shiro.authc.AuthenticationInfo |
authenticate(org.apache.shiro.authc.AuthenticationToken authenticationToken)This is a placeholder method for the target Realm. |
|
void |
checkPermission(org.apache.shiro.subject.PrincipalCollection principal, org.apache.shiro.authz.Permission permission)Check for a permission |
|
void |
checkPermission(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String s)Ensures the corresponding Subject/user implies the specified permission String. |
|
void |
checkPermissions(org.apache.shiro.subject.PrincipalCollection principal, java.util.Collection<org.apache.shiro.authz.Permission> permissions)Check for a set of permissions, the user must have all permissions. |
|
void |
checkPermissions(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String[] strings)Ensures the corresponding Subject/user org.apache.shiro.authz.Permission#implies(org.apache.shiro.authz.Permission) all of the specified permission strings. |
|
void |
checkRole(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String role)Check user has a named role |
|
void |
checkRoles(org.apache.shiro.subject.PrincipalCollection principal, java.util.Collection<java.lang.String> roles)Check a user has a set of named roles. |
|
void |
checkRoles(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String[] roles)Same as checkRoles(PrincipalCollection subjectPrincipal, Collection<String> roleIdentifiers) but doesn't require a collection as an argument. |
|
org.apache.shiro.authc.AuthenticationInfo |
getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken)Wraps the authenticate method logging unable to authenticate exceptions |
|
java.lang.String |
getName() |
|
org.apache.shiro.authz.permission.PermissionResolver |
getPermissionResolver() |
|
boolean |
hasAllRoles(org.apache.shiro.subject.PrincipalCollection principalCollection, java.util.Collection<java.lang.String> roles)This should be implemented in your realm either as the simplified version in SimplifiedRealm or a just override this. |
|
boolean |
hasAllRoles(java.lang.Object principal, java.util.Collection<java.lang.String> roles) |
|
boolean |
hasRole(org.apache.shiro.subject.PrincipalCollection principalCollection, java.lang.String role)This should be implemented in your realm either as the simplified version in SimplifiedRealm or a just override this. |
|
boolean |
hasRole(java.lang.Object principal, java.lang.String roleName) |
|
boolean[] |
hasRoles(org.apache.shiro.subject.PrincipalCollection principalCollection, java.util.List<java.lang.String> roles)Default implementation using hasRole in a loop override if you can do better. |
|
boolean |
isPermitted(org.apache.shiro.subject.PrincipalCollection principalCollection, org.apache.shiro.authz.Permission permission)This should be implemented in your realm either as the simplified version in SimplifiedRealm or a just override this. |
|
boolean |
isPermitted(java.lang.Object principal, org.apache.shiro.authz.Permission requiredPermission) |
|
boolean[] |
isPermitted(org.apache.shiro.subject.PrincipalCollection principalCollection, java.util.List<org.apache.shiro.authz.Permission> permissions)Default implementation of
|
|
boolean |
isPermitted(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String s)Convert the permission string to a Permission and then check it. |
|
boolean[] |
isPermitted(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String[] strings)Checks if the corresponding Subject implies the given permission strings and returns a boolean array indicating which permissions are implied. |
|
boolean |
isPermittedAll(org.apache.shiro.subject.PrincipalCollection principalCollection, java.util.Collection<org.apache.shiro.authz.Permission> permissions)Default implementation of
|
|
boolean |
isPermittedAll(org.apache.shiro.subject.PrincipalCollection principal, java.lang.String[] strings)Returns true if the corresponding Subject/user implies all of the specified permission strings, false otherwise. |
|
org.apache.shiro.authc.SimpleAuthenticationInfo |
makeSimpleAuthInfoSansCredentials(java.util.Collection principals)A helper method to create a SimpleAuthenticationInfo from a collection of principal objects. |
|
org.apache.shiro.authc.SimpleAuthenticationInfo |
makeSimpleAuthInfoSansCredentials(java.lang.Object principal)A helper method to create a SimpleAuthenticationInfo from a principal object. |
|
void |
onLogout(org.apache.shiro.subject.PrincipalCollection principal)Placeholder do nothing on logout override as required |
|
void |
setPermissionResolver(org.apache.shiro.authz.permission.PermissionResolver pr)Set the permission resolver. |
|
void |
setTokenClass(java.lang.Class clazz) |
|
boolean |
supports(org.apache.shiro.authc.AuthenticationToken authenticationToken)Default implementation, checks the tokenClass |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
This is a placeholder method for the target Realm. If you don't implement authenticate then you'll get a NotImplementedException
authenticationToken - AuthenticationToken to authenticateCheck for a permission
Ensures the corresponding Subject/user implies the specified permission String.
principal - a PrincipalCollections - the permission String to useCheck for a set of permissions, the user must have all permissions.
Ensures the corresponding Subject/user org.apache.shiro.authz.Permission#implies(org.apache.shiro.authz.Permission) all of the specified permission strings.
principal - a PrincipalCollectionstrings - the permission Strings to useCheck user has a named role
Check a user has a set of named roles. The user must have all the roles.
Same as checkRoles(PrincipalCollection subjectPrincipal, Collection<String> roleIdentifiers) but doesn't require a collection as an argument.
principal - a PrincipalCollectionroles - role name stringsWraps the authenticate method logging unable to authenticate exceptions
This should be implemented in your realm either as the simplified version in SimplifiedRealm or a just override this.
This should be implemented in your realm either as the simplified version in SimplifiedRealm or a just override this.
Default implementation using hasRole in a loop override if you can do better.
This should be implemented in your realm either as the simplified version in SimplifiedRealm or a just override this.
Default implementation of
Convert the permission string to a Permission and then check it. The Authorizer interface does not specify that it can throw an Authorization exception which is sensible for an boolean method. So if the PermissionResolver.resolvePermission() throws an InvalidPermissionStringException we return false
principal - a PrincipalCollections - the permission String to useChecks if the corresponding Subject implies the given permission strings and returns a boolean array indicating which permissions are implied.
The Authorizer interface does not specify that it can throw an Authorization exception which is sensible for an boolean method. So if the PermissionResolver.resolvePermission() throws an InvalidPermissionStringException we return boolean[0]
principal - a PrincipalCollectionstrings - the permission Strings to useDefault implementation of
Returns true if the corresponding Subject/user implies all of the specified permission strings, false otherwise. The Authorizer interface does not specify that it can throw an Authorization exception which is sensible for an boolean method. So if the PermissionResolver.resolvePermission() throws an InvalidPermissionStringException we return boolean[0]
principal - a PrincipalCollectionstrings - the permission Strings to useA helper method to create a SimpleAuthenticationInfo from a collection of principal objects. This does not set any credentials.
A helper method to create a SimpleAuthenticationInfo from a principal object. This does not set any credentials.
Placeholder do nothing on logout override as required
Set the permission resolver. This is initially set to WildcardPermissionResolver unless replaced via spring
Default implementation, checks the tokenClass