Skip to content

Commit 472cc7b

Browse files
committed
cache note added
1 parent bb1346d commit 472cc7b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

documentation/AUTHENTICATION.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,26 @@ Simply switch on the Microsoft Entra ID option for your App Service on the AZD c
1818

1919
## SAP Principal Propagation
2020

21-
Consider SAP Principal Propagation for your authentication scenario handled by [Azure API Management](https://learn.microsoft.com/azure/api-management/sap-api#production-considerations). Activate `useAPIM` flag to inject OData API into Azure API Management and pre-authorize its exposed scopes to the Azure web app.
21+
Consider SAP Principal Propagation for your authentication scenario handled by [Azure API Management (APIM)](https://learn.microsoft.com/azure/api-management/sap-api#production-considerations). Activate `useAPIM` flag to inject OData API into Azure API Management and pre-authorize its exposed scopes to the Azure web app.
2222

2323
[Learn more](https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Request%20OAuth2%20access%20token%20from%20SAP%20using%20AAD%20JWT%20token.xml)
2424

2525
![Overview of authentication flow and trust relationship of SAP services with Azure and Entra ID](../assets/app-auth-principal-propagation.svg)
26+
27+
## Avoiding SAP login bursts ("monday morning blues")
28+
29+
People have routines and therefore tend to create clusters of logins at similar times. SAP's OAuth server can become a bottleneck during such periods. We recommend to adjust the default token lifetimes on the SAP OAuth server and implement a random back off delay parameter. That parameter ensures that your cached user tokens don't expire all at the same time even though your users tend to login in waves (monday morning for instance). The provided [APIM policy](https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Request%20OAuth2%20access%20token%20from%20SAP%20using%20AAD%20JWT%20token.xml) supports that approach. See below an example to illustrate the process:
30+
31+
![token lifetime illustration](/apim-backoff-delay.png)
32+
33+
Of course on the very first day of your implementation when no tokens are cached yet, you are still in trouble ;-) It is recommend to rely on an [APIM throttling policy](https://docs.microsoft.com/azure/api-management/api-management-sample-flexible-throttling) in such cases. Likely you will need to experiment a bit with the parameters to find your individual optimal fit.
34+
35+
## X-CSRF-Token handling
36+
37+
SAP OData services are protected by CSRF tokens usually.
38+
39+
Consider our SAP specific [APIM policy](https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Request%20OAuth2%20access%20token%20from%20SAP%20using%20AAD%20JWT%20token.xml) to inspect http calls for csrf tokens to ease the burden on your client apps.
40+
41+
## Client logout and cache purge
42+
43+
If you are using APIM to deal with your tokens, you should consider implementing a logout endpoint that purges the tokens for an individual client from the cache. See the [Microsoft docs](https://docs.microsoft.com/azure/api-management/api-management-caching-policies#RemoveCacheByKey) for cache maintenance for more details.

0 commit comments

Comments
 (0)