You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugin-core/docs/src/docs/domainClasses/requestmapClass.adoc
+16-15Lines changed: 16 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,36 +18,37 @@ under the License.
18
18
////
19
19
20
20
[[requestmapClass]]
21
-
=== Requestmap Class
21
+
=== Requestmap Domain Class
22
22
23
-
Optionally, use this class to store request mapping entries in the database instead of defining them with annotations or in `application.groovy`. This option makes the class configurable at runtime; you can add, remove and edit rules without restarting your application.
23
+
Create and use a domain class to store request mapping entries in the database instead of defining them with annotations
24
+
or in `application.groovy`. This option makes the rules configurable at runtime; you can add, remove and edit rules
25
+
without restarting your application.
24
26
25
27
.Requestmap class configuration options
26
28
[cols="30,30,40"]
27
29
|====================
28
30
| *Property* | *Default Value* | *Meaning*
29
31
30
32
|requestMap.className
31
-
|_none_
32
-
|requestmap class name
33
+
|_none_ - set to your implementation
34
+
|requestmap domain class
33
35
34
36
|requestMap.urlField
35
-
|"`url`"
37
+
|"url"
36
38
|URL pattern property name
37
39
38
40
|requestMap.configAttributeField
39
-
|"`configAttribute`"
41
+
|"configAttribute"
40
42
|authority pattern property name
41
43
42
44
|requestMap.httpMethodField
43
-
|"`httpMethod`"
45
+
|"httpMethod"
44
46
|HTTP method property name (optional, does not have to exist in the class if you don't require URL/method security)
45
47
|====================
46
48
47
-
Assuming you choose `com.mycompany.myapp` as your package, and `Requestmap` as your class name, you'll generate this class:
49
+
Assuming you choose `com.mycompany.myapp` as your package, and `SecurityMapping` as your class name, you'll generate this class:
Copy file name to clipboardExpand all lines: plugin-core/docs/src/docs/requestMappings/requestmapInstances.adoc
+35-24Lines changed: 35 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,68 +18,79 @@ under the License.
18
18
////
19
19
20
20
[[requestmapInstances]]
21
-
=== Requestmap Instances Stored in the Database
21
+
=== Request Mappings Stored in the Database
22
22
23
-
With this approach you use the `Requestmap` domain class to store mapping entries in the database. `Requestmap` has a `url` property that contains the secured URL pattern and a `configAttribute` property containing a comma-delimited list of required roles, SpEL expressions, and/or tokens such as `IS_AUTHENTICATED_FULLY`, `IS_AUTHENTICATED_REMEMBERED`, and `IS_AUTHENTICATED_ANONYMOUSLY`.
23
+
With this approach you create and use a domain class to store security mapping entries in the database.
24
24
25
-
To use `Requestmap` entries, specify `securityConfigType="Requestmap"`:
25
+
The domain class must have the following properties:
26
+
27
+
* `url` - the secured URL pattern
28
+
* `httpMethod` - the http method for which the rule applies (or null for all methods)
29
+
* `configAttribute` - containing a comma-delimited list of required roles,
30
+
SpEL expressions, and/or tokens such as `IS_AUTHENTICATED_FULLY`, `IS_AUTHENTICATED_REMEMBERED`,
31
+
and `IS_AUTHENTICATED_ANONYMOUSLY`
32
+
33
+
To use database-backed url security mappings, use the following configuration:
26
34
27
35
[source,groovy]
28
-
.Listing {counter:listing}. Specifying `securityConfigType` as "`Requestmap`"
The `configAttribute` value can have a single value or have multiple comma-delimited values. In this example only users with `ROLE_ADMIN` or `ROLE_SUPERVISOR` can access `/admin/user/pass:[**]` urls, and only users with `ROLE_SWITCH_USER` can access the switch-user url (`/login/impersonate`) and in addition must be authenticated fully, i.e. not using a remember-me cookie. Note that when specifying multiple roles, the user must have at least one of them, but when combining `IS_AUTHENTICATED_FULLY`, `IS_AUTHENTICATED_REMEMBERED`, or `IS_AUTHENTICATED_ANONYMOUSLY` with one or more roles means the user must have one of the roles and satisty the `IS_AUTHENTICATED` rule.
67
+
The `configAttribute` value can have a single value or have multiple comma-delimited values. In this example only users with `ROLE_ADMIN` or `ROLE_SUPERVISOR` can access `/admin/user/pass:[**]` urls, and only users with `ROLE_SWITCH_USER` can access the switch-user url (`/login/impersonate`) and in addition must be authenticated fully, i.e. not using a remember-me cookie. Note that when specifying multiple roles, the user must have at least one of them, but when combining `IS_AUTHENTICATED_FULLY`, `IS_AUTHENTICATED_REMEMBERED`, or `IS_AUTHENTICATED_ANONYMOUSLY` with one or more roles means the user must have one of the roles and satisfy the `IS_AUTHENTICATED` rule.
57
68
58
-
Unlike the `application.groovy` Map approach (<<configGroovyMap>>), you do not need to revise the `Requestmap` entry order because the plugin calculates the most specific rule that applies to the current request.
69
+
Unlike the `application.groovy` map approach (<<configGroovyMap>>), you do not need to revise the request map entry order because the plugin calculates the most specific rule that applies to the current request.
59
70
60
-
==== Requestmap Cache
71
+
==== Request Map Cache
61
72
62
-
`Requestmap` entries are cached for performance, but caching affects runtime configurability. If you create, edit, or delete an instance, the cache must be flushed and repopulated to be consistent with the database. You can call `springSecurityService.clearCachedRequestmaps()` to do this. For example, if you create a `RequestmapController` the `save` action should look like this (and the update and delete actions should similarly call `clearCachedRequestmaps()`):
73
+
Request map entries are cached for performance, but caching affects runtime configurability. If you create, edit, or delete an instance, the cache must be flushed and repopulated to be consistent with the database. You can call `springSecurityService.clearCachedRequestmaps()` to do this. For example, if you create a `RequestSecurityRuleController` the `save` action should look like this (and the update and delete actions should similarly call `clearCachedRequestmaps()`):
0 commit comments