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: docs/developer-guide/local-config.md
+74-25Lines changed: 74 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,17 +45,30 @@ This is the main structure:
45
45
// path to the translation files directory (if different from default)
46
46
"translationsPath",
47
47
// if true, every ajax and mapping request will be authenticated with the configurations if match a rule (default: true)
48
-
"useAuthenticationRules":true
49
-
// the authentication rules to match
50
-
"authenticationRules": [
51
-
{ // every rule has a `urlPattern` regex to match
52
-
"urlPattern":".*geostore.*",
53
-
// and a authentication `method` to use (basic, authkey, browserWithCredentials, header)
54
-
"method":"basic"
55
-
}, {
56
-
"urlPattern":"\\/geoserver.*",
57
-
"method":"authkey"
58
-
}],
48
+
// the request configuration rules to match
49
+
"requestsConfigurationRules": [
50
+
{ // every rule has a `urlPattern` regex to match
51
+
"urlPattern":".*geostore.*",
52
+
// headers to add to matching requests
53
+
"headers": {
54
+
"Authorization":"Bearer ${securityToken}"
55
+
}
56
+
}, {
57
+
"urlPattern":"\\/geoserver/.*",
58
+
// parameters to add to matching requests
59
+
"params": {
60
+
"authkey":"${securityToken}"
61
+
}
62
+
}, {
63
+
"urlPattern":".*azure-blob.*",
64
+
// expiration timestamp (optional, Unix timestamp in seconds)
65
+
"expires":1735689600,
66
+
// parameters can be used for SAS tokens
67
+
"params": {
68
+
"sv":"2024-11-04",
69
+
"sig":"${sasToken}"
70
+
}
71
+
}],
59
72
// flag for postponing mapstore 2 load time after theme
60
73
"loadAfterTheme":false,
61
74
// if defined, WMS layer styles localization will be added
@@ -150,23 +163,59 @@ For configuring plugins, see the [Configuring Plugins Section](plugins-documenta
150
163
-`initialState`: is an object that will initialize the state with some default values and this WILL OVERRIDE the initialState imposed by plugins & reducers.
151
164
-`projectionDefs`: is an array of objects that contain definitions for Coordinate Reference Systems
152
165
-`gridFiles`: is an object that contains definitions for grid files used in coordinate transformations
153
-
-`useAuthenticationRules`: if this flag is set to true, the `authenticationRules` will be used to authenticate every ajax and mapping request. If the flag is set to false, the `authenticationRules` will be ignored.
154
-
-`authenticationRules`: is an array of objects that contain rules to match for authentication. Each rule has a `urlPattern` regex to match and a `method` to use (`basic`, `authkey`, `header`, `browserWithCredentials`). If the URL of a request matches the `urlPattern` of a rule, the `method` will be used to authenticate the request. The `method` can be:
155
-
-`basic` will use the basic authentication method getting the credentials from the user that logged in (adding the header `Authorization``Basic <base64(username:password)>` to the request). ***Note**: this method is not implemented for image tile requests (e.g. layers) but only for ajax requests.*
156
-
-`authkey` will use the authkey method getting the credentials from the user that logged in. The token of the current MapStore session will be used as the authkey value, so this works only with the geoserver integration.
157
-
-`bearer` will use the header `Authorization``Bearer <token>` getting the credentials from the user that logged in. The token of the current MapStore session will be used as the bearer value, so this works only with the geoserver integration.
158
-
-`header` will use the header method getting the credentials from the user that logged in. You can add an `headers` object containing the static headers to this rule to specify witch headers to use. e.g.
159
-
-`browserWithCredentials` will add the `withCredentials` parameter to ajax requests, so the browser will send the cookies and the authentication headers to the server. This method is useful when you have a proxy that needs to authenticate the user. ***Note**: this method is not implemented for image tile requests (e.g. layers) but only for ajax requests.*
160
-
161
-
```json
166
+
-`useAuthenticationRules` (deprecated): if this flag is set to true, legacy `authenticationRules` will be used. The new `requestsConfigurationRules` system does not require this flag and is always active when rules are present.
167
+
-`requestsConfigurationRules`: is an array of objects that contain rules to match for request configuration. Each rule has a `urlPattern` regex to match and either `headers`, `params`, or `withCredentials` configuration. If the URL of a request matches the `urlPattern` of a rule, the configuration will be applied to the request.
168
+
169
+
**Available variable for template substitution (ES6 template syntax `${variable}`):**
170
+
-`${securityToken}` - The current MapStore session token (automatically replaced)
171
+
172
+
**Configuration options:**
173
+
-`headers` - Object containing HTTP headers to add to matching requests. Example:
174
+
175
+
```json
162
176
{
163
-
"urlPattern": ".*geostore.*",
164
-
"method": "header",
165
-
"headers": {
166
-
"X-Auth-Token": "mytoken"
167
-
}
177
+
"urlPattern": ".*geostore.*",
178
+
"headers": {
179
+
"Authorization": "Bearer ${securityToken}"
180
+
}
168
181
}
169
182
```
183
+
184
+
- `params` - Object containing query parameters to add to matching requests. Example:
185
+
186
+
```json
187
+
{
188
+
"urlPattern": "\\/geoserver/.*",
189
+
"params": {
190
+
"authkey": "${securityToken}"
191
+
}
192
+
}
193
+
```
194
+
195
+
- `withCredentials` - Boolean to enable sending credentials with requests (useful with proxies):
196
+
197
+
```json
198
+
{
199
+
"urlPattern": ".*internal-api.*",
200
+
"withCredentials": true
201
+
}
202
+
```
203
+
204
+
- `expires` - Optional Unix timestamp (in seconds) for automatic rule expiration. Example:
205
+
206
+
```json
207
+
{
208
+
"urlPattern": ".*azure-blob.*",
209
+
"expires": 1735689600,
210
+
"params": {
211
+
"sv": "2024-11-04",
212
+
"sig": "token"
213
+
}
214
+
}
215
+
```
216
+
217
+
!!! note "Backward Compatibility"
218
+
The old `useAuthenticationRules` and `authenticationRules` configuration still works and will be automatically converted to the new format. However, the new format is recommended for better flexibility and features like expiration support.
Copy file name to clipboardExpand all lines: docs/developer-guide/mapstore-migration-guide.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,65 @@ This is a list of things to check if you want to update from a previous version
20
20
- Optionally check also accessory files like `.eslinrc`, if you want to keep aligned with lint standards.
21
21
- Follow the instructions below, in order, from your version to the one you want to update to.
22
22
23
+
## Migration from 2025.02.02 to 2026.01.00
24
+
25
+
### Replace authenticationRules with requestsConfigurationRules
26
+
27
+
As part of improving the authentication rules to make dynamic request configurations, we have deprecated the use of `authenticationRules` in favor of the new request rule configuration `requestsConfigurationRules`. The new system provides a more flexible way to configure request authentication and parameters.
28
+
29
+
### Configuration Changes
30
+
31
+
#### Old Configuration (authenticationRules)
32
+
33
+
```json
34
+
{
35
+
"useAuthenticationRules": true,
36
+
"authenticationRules": [
37
+
{
38
+
"urlPattern": ".*rest/geostore.*",
39
+
"method": "bearer"
40
+
},
41
+
{
42
+
"urlPattern": ".*rest/config.*",
43
+
"method": "bearer"
44
+
}
45
+
]
46
+
}
47
+
```
48
+
49
+
#### New Configuration (requestsConfigurationRules)
50
+
51
+
```json
52
+
{
53
+
"requestsConfigurationRules": [
54
+
{
55
+
"urlPattern": ".*rest/geostore.*",
56
+
"headers": {
57
+
"Authorization": "Bearer ${securityToken}"
58
+
}
59
+
},
60
+
{
61
+
"urlPattern": ".*rest/config.*",
62
+
"headers": {
63
+
"Authorization": "Bearer ${securityToken}"
64
+
}
65
+
}
66
+
]
67
+
}
68
+
```
69
+
70
+
**Note**: The `${securityToken}` placeholder is automatically replaced at runtime with the actual security token from the security context
0 commit comments