Skip to content

Commit 971c902

Browse files
authored
Merge pull request #37 from marin-bratanov/patch-1
Clarify MSM and REST API session stickiness
2 parents 1675036 + 529f62e commit 971c902

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

APIs/REST-API/Authentication/index.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,30 @@ Note that the plugin configuration may contain a flag named `UseIdTokenAsAccessT
407407

408408
## Multi-Server Mode Considerations
409409

410-
In platforms that use the M-Files [Multi-Server Mode]({{ site.baseurl }}/Frameworks/Vault-Application-Framework/Multi-Server-Mode/) approach (e.g. the M-Files "New Cloud"), M-Files servers to be attached to the same vault database at the same time. In this configuration, any one of the multiple servers in the availability group may potentially respond to individual REST API calls.
410+
In platforms that use the M-Files [Multi-Server Mode]({{ site.baseurl }}/Frameworks/Vault-Application-Framework/Multi-Server-Mode/) approach (e.g. the M-Files Cloud), multiple M-Files servers will be attached to the same vault database at the same time. In this configuration, any one of the multiple servers in the availability group may potentially respond to individual REST API calls.
411411

412-
One issue that developers may encounter is that authentication tokens created via a call to server A cannot be decrypted and used on servers B or C. In this instance you will receive an error about `OAEP padding`.
412+
One issue that developers may encounter is that authentication tokens created via a call to server A cannot be decrypted and used on servers B or C. In this instance you will receive an error about `OAEP padding` similar to:
413413

414-
To resolve this, the developer must ensure that any cookies that are provided within the HTTP response of `/server/authenticationtokens` are added to any and all subsequent REST API calls. By doing so, future requests will be routed to the same server that provided the token, ensuring that they can be correctly used.
414+
```
415+
Error Message : "Method": "POST",
416+
"Exception": {
417+
"Name": "ForbiddenException",
418+
"Message": "Token-based authentication failed.",
419+
"InnerException": {
420+
"Name": "CryptographicException",
421+
"Message": "Error occurred while decoding OAEP padding.",
422+
. . .
423+
```
424+
425+
To resolve this, the developer and the server administrator must ensure that the same server that provided the `/server/authenticationtokens` response will receive the future requests that carry it, ensuring that the token can be correctly used.
415426

416-
See [MFWSClient.Authentication.cs](https://github.com/M-Files/Libraries.MFWSClient/blob/master/MFaaP.MFWSClient/MFWSClient.Authentication.cs) in [MFWSClient](https://github.com/M-Files/Libraries.MFWSClient) (C# M-Files Web Service Wrapper) as an example of setting up cookies with CookieContainer.
427+
In the M-Files Cloud, this is achieved by sending any cookies that are provided within the HTTP response of `/server/authenticationtokens` are added to any and all subsequent REST API calls. The name of the cookie use to provide the session stickiness in the M-Files Cloud is `mfilesmsm`.
428+
429+
In on-premises environments, the local administrators must provide a suitable way to have that session stickiness, which depends on the local infrastructure capabilities and administrator preferences.
430+
431+
See [MFWSClient.Authentication.cs](https://github.com/M-Files/Libraries.MFWSClient/blob/master/MFaaP.MFWSClient/MFWSClient.Authentication.cs) in [MFWSClient](https://github.com/M-Files/Libraries.MFWSClient) (C# M-Files Web Service Wrapper) as an example of setting up cookies with `CookieContainer`.
417432
{:.note}
418433

419434
You will still need to handle any `403` HTTP status codes that you may receive in the future and re-request an authentication token. This could happen for the same reasons as in a single-server instance (e.g. if the token times out, or the credentials are changed on the server), but could also happen if the server used to create the token is no longer available (e.g. if it goes offline). By re-requesting the authentication token and using the newly-provided session ID, the integration will now start to use (and continue to consistently use) a different server in the availability group.
420435
{:.note}
436+

0 commit comments

Comments
 (0)