There are three communicating parties in our system:
- Frontend
- Service A
- Service B
plus we have stand-alone security token service, our identity provider.
Authenticated user interacts with Frontend, it calls Service A, which in turn calls Service B. User's access token is passed through this pipeline using "poor's man identity delegation". Service A and Service B authorize (or not authorize) user's actions based on claims in passed identity. Everybody is happy!
But now I ran into situation when Service A has no user context during operation. It happens:
- during startup
- when Service A processes message from message bus
- when timer fires
In each cases Service A needs to call Service B to obtain some data, but it receives 401, because no access token passed to Service B.
Are there any best practices how to handle such situation? The only idea I have in my head now is to register 'System' user (possible user per Service A, Service B, Service C etc.) in our identity provider, obtain access token for this user and use it in cases described above. But I smells bad for me and I'm looking for alternative ideas.
Any suggestions would be appreciated. Thank you!