@groovy.util.logging.Slf4j class SpringSecurityService extends java.lang.Object
Utility methods.
Modifiers | Name | Description |
---|---|---|
protected static java.util.List<java.lang.String> |
NO_SALT |
Type | Name and description |
---|---|
org.springframework.security.authentication.AuthenticationTrustResolver |
authenticationTrustResolver dependency injection for authenticationTrustResolver |
grails.core.GrailsApplication |
grailsApplication dependency injection for grailsApplication |
java.lang.Object |
objectDefinitionSource dependency injection for org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource |
java.lang.Object |
passwordEncoder dependency injection for the password encoder |
Constructor and description |
---|
SpringSecurityService() |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
clearCachedRequestmaps() Call when editing, creating, or deleting a Requestmap to flush the cached configuration and rebuild using the most recent data. |
|
void |
createRequestMaps(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> data) Create multiple requestmap instances in a transaction. |
|
void |
createRequestMaps(java.util.List<java.lang.String> urls, java.lang.String configAttribute) Create multiple requestmap instances in a transaction that all share the same configAttribute . |
|
void |
deleteRole(java.lang.Object role) Delete a role, and if Requestmap class is used to store roles, remove the role from all Requestmap definitions. |
|
java.lang.String |
encodePassword(java.lang.String password) Encode the password using the configured PasswordEncoder. |
|
protected java.util.List |
findRequestmapsByRole(java.lang.String roleName, java.lang.Object conf) |
|
org.springframework.security.core.Authentication |
getAuthentication() Get the currently logged in user's Authentication . |
|
protected java.lang.Class<?> |
getClassForName(java.lang.String name) |
|
java.lang.Object |
getCurrentUser() Get the domain class instance associated with the current authentication. |
|
java.lang.Object |
getCurrentUserId() |
|
java.lang.Object |
getPrincipal() Get the currently logged in user's principal. |
|
protected groovy.util.ConfigObject |
getSecurityConfig() |
|
boolean |
isAjax(jakarta.servlet.http.HttpServletRequest request) Check if the request was triggered by an Ajax call. |
|
boolean |
isLoggedIn() Quick check to see if the current user is logged in. |
|
java.lang.Object |
loadCurrentUser() Get a proxy for the domain class instance associated with the current authentication. |
|
void |
reauthenticate(java.lang.String username, java.lang.String password) Rebuild an Authentication for the given username and register it in the security context. |
|
void |
reloadDBRoleHierarchy() Call for reloading the role hierarchy configuration from the database. |
|
boolean |
updateRole(java.lang.Object role, java.lang.Object newProperties) Update a role, and if Requestmap class is used to store roles, replace the new role name in all Requestmap definitions that use it if the name was changed. |
|
protected boolean |
useRequestmaps() |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
dependency injection for authenticationTrustResolver
dependency injection for grailsApplication
dependency injection for org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource
dependency injection for the password encoder
Call when editing, creating, or deleting a Requestmap to flush the cached configuration and rebuild using the most recent data.
Create multiple requestmap instances in a transaction.
data
- a list of maps where each map contains the data for one instance
(configAttribute and url are required, httpMethod is optional) Create multiple requestmap instances in a transaction that all share the same configAttribute
.
urls
- a list of url patternsDelete a role, and if Requestmap class is used to store roles, remove the role from all Requestmap definitions. If a Requestmap's config attribute is this role, it will be deleted.
role
- the role to deleteEncode the password using the configured PasswordEncoder.
Get the currently logged in user's Authentication
. If not authenticated
and the AnonymousAuthenticationFilter is active (true by default) then the anonymous
user's auth will be returned (AnonymousAuthenticationToken with username 'anonymousUser'
unless overridden).
Get the domain class instance associated with the current authentication.
Get the currently logged in user's principal. If not authenticated and the AnonymousAuthenticationFilter is active (true by default) then the anonymous user's name will be returned ('anonymousUser' unless overridden).
Check if the request was triggered by an Ajax call.
request
- the requesttrue
if AjaxQuick check to see if the current user is logged in.
true
if the user is authenticated and not anonymousGet a proxy for the domain class instance associated with the current authentication. Use this when you want the user only for its id, e.g. as a proxy for the foreign key in queries like "CreditCard.findAllByUser(user)"
Rebuild an Authentication for the given username and register it in the security context. Typically used after updating a user's authorities or other auth-cached info.
Also removes the user from the user cache to force a refresh at next login.username
- the user's login namepassword
- optionalCall for reloading the role hierarchy configuration from the database.
Update a role, and if Requestmap class is used to store roles, replace the new role name in all Requestmap definitions that use it if the name was changed.
role
- the role to updatenewProperties
- the new role attributes ('params' from the calling controller)Groovy Documentation