-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[micro-service] Set target-issuer from disco response and decide backend by target-issuer #220
[micro-service] Set target-issuer from disco response and decide backend by target-issuer #220
Conversation
8b4873e
to
61def46
Compare
d81defc
to
15fa195
Compare
15fa195
to
ce9cd5d
Compare
1fb1734
to
cba0eaf
Compare
c307bf4
to
8ff3572
Compare
03afea4
to
603c03f
Compare
15e15da
to
f22d38c
Compare
6c7f70e
to
d46c86f
Compare
969a2ba
to
4341437
Compare
@peppelinux with the latest changes we now have two micro-services, with the test rewritten to test both services.
Nothing else is done, but what is necessary for these goals. The responsibilities are clear.
Also, squashed and rebased on top of current master. |
4341437
to
612e205
Compare
Signed-off-by: Ivan Kanakarakis <[email protected]>
612e205
to
4ec361c
Compare
I have to test It, probably tomorrow |
@c00kiemon5ter I MUST set
I made my tests, It seems to me that's quite good as it is now |
Signed-off-by: Ivan Kanakarakis <[email protected]>
When the processing of the request micro-services is finished, the context is switched from the frontend to the backend. At that point target_frontend is needed to set the state of the router. The router state will be used when the processing of the response by the response micro-services is finished, to find the appropriate frontend instance. --- The routing state is set at the point when the switch from the frontend (and request micro-service processing) is made towards the backend. If the discovery response was not intercepted by the DiscoToTargetIssuer micro-service, and instead was processed by the backend's disco-response handler, the target_frontend would not be needed, as the routing state would have already been set. When the DiscoToTargetIssuer micro-service intercepts the response, the point when the switch from the frontend to the backend happens will be executed again. Due to leaving the proxy, going to the discovery service and coming back to the proxy, context.target_frontend has been lost. Only the state stored within context.state persists (through the cookie). --- When the request micro-services finish processing the request, backend_routing is called, which sets the router state (context.state['ROUTER']) to target_frontend, and returns the appropriate backend instance based on target_backend. When the time comes to switch from the backend to the frontend, that state is looked up (see below). When the response micro-services finish processing the response, frontend_routing is called, which sets target_frontend from the router state (context.state['ROUTER']) and returns the appropriate frontend instance based on target_frontend. --- Signed-off-by: Ivan Kanakarakis <[email protected]>
5c8eaeb
to
d7e4572
Compare
Hello @peppelinux, I made another update, effectively moving the responsibility to set the The reason we need to set Because we have navigated away from the proxy (we redirected to the discovery service) the data on context has been lost (including the target_frontend) except for the state (persisted on the cookie). Now that we need to go through the switch to the backend again - but without a target_frontend - the error occurs. To fix it, we make sure that we store the target_frontend on the cookie, and restore it once we have a response from the discovery service. This process does not involve the selection of the backend. Thus this is the responsibility of the Ideally, |
Please, have a look and test it. Then we should merge ;) |
Ok, everything works great even with idp_hinting ... Three year passed meantime but it was worth of it, let's merge it now! |
hey, this seems to purpose the same or a similar goal of this PR |
Hello,
I developed a microservice that can map specific SaToSa backends to specific target entity id. A configuration example can be this:
In the debug logs if the microservice has been activated we can read
I needed a backend routing based on the target entity ID because I have some SAML2 IDP that only accepts highly customized authn request and metadata. An example could be SPID italian federation. Another example could be the need to use different configurations, like sign and digest algorithms, depending by target IDP.
I was looking into DecideBackendByRequester microservice but soon I realized that it was made for different goals, in it the subjects are the requester entity ID and not the target entity ID.
This PR also answers to my related issue.