Forum Discussion
F5 SSO - OAuth with SAML - how to preserve the original protect URL
Hi
Thanks for the input, see if i can try again
https://uat/some/protected/url << APM policy that use oauth client - client/resource
If I don't have a APM session the first response is a 302 to /my.policy
I don't get to run any code - how do I insert a cookie at this stage don't think i can ?
https://uat/my.policy does the redirect to https://auth/someOAuth URL (<< this is the oauth server ) it doesn't know what the original URL was.
About the cookie it is in the links I shared with you that you can take a look at 🙂
Stange from what I have seen after you are returned from the Azure AD you get the url you tried to open. The issue you mentioned I have only when playing for example with the https://petstore.swagger.io/ as a pool member test app as to when I do not send a specific correct request the F5 APM just can't fetch the page. The issue was resolved when I attached URI rewrite profile so that when I send the http traffic to the pool members to change the URI to the real one that that the pool members use so I do not see this issue as it is normal when F5 can't resolve the HTTP request will the backend servers to give you a hint like in my case it was""" xxxx/oauth/login.jsp """ and the below message.
Outside of that it could be a bug so I am on 16.1.3.2 so upgrade to it or you may try URI redirec in the policy as the your landing URI is saved to variable session.server.landinguri , so you may to use something like the link below or an iRule as given in the next Links to "get" the session variable and then to use it for an redirect event.
https://community.f5.com/t5/technical-forum/landing-uri-irule-http-redirection/td-p/34919
https://clouddocs.f5.com/api/irules/ACCESS_POLICY_COMPLETED.html
https://clouddocs.f5.com/api/irules/ACCESS__session.html
That are all my ideas.
- AlexS_ybDec 01, 2022Cirrocumulus
Hi
Think I haven't explained to well.
Setting a cookie on a APM call. why I asked about this is because of the interaction between irules and APM, I can set it on http_request but that just sets it to the back end pool. I thnk I need to set it on http_response - how does that work on APM calls
Not sure where azule AD came up. All components are on F5 - different boxes
SAML login -> https://login.local
OAUTH server -> https://auth.local
resource server -> https://resource.local
The protected URL
https://resource.local/protectedURL
APM for VS that has https://resource.local protects the url with an OAuth client (VPE). then does the redirect. At this point the original URL is lost - its not part of the URL and it hasn't been saved as a URL.
I guess because I have lots of landing places for OAUTH I can't use client id and post back.
I notice a lot of other SSO's append the destiation URL to the url so
https://resource.local/protectedURL would turn into https://resource.local/login/protectedURL
and maybe https://auth.local/login/https://resource.local/protectedURL
presumably with url encode.
- Nikoolayy1Dec 02, 2022MVP
As I mentioned on my Azure AD intergration I do not see your issue, so this could be limited to your environment. Also for the cookie part there is really a lot of examples from F5 or in the commnity if you just search for them.
Examples. It is for portal access but you may test it to see if it works for you as well as your issue indicates that you may need to do a lot of testing. You may need to access the session variable for the landing URL in with "ACCESS::session data gest", save it to a normal irule variable as to use it in later events like HTTP_RESPONSE or HTTP_RESPONSE_RELEASE (this is when the F5 generates the response but as it is not the case with you maybe using portal access HTTP_RESPONSE could be the right event for you).
https://clouddocs.f5.com/api/irules/HTTP__cookie.html
You can trigger iRules in APM with an Agent but maybe this willl not be needed as when you want to add something to the the Response not Request then this means that the user should have passed the APM policy, but I am just sharing with you.
https://clouddocs.f5.com/api/irules/ACCESS_POLICY_AGENT_EVENT.html
Outside of that I can't suggest anything else as I am not familiar with your network environment like you are as you can see that F5 generates HTTP 301/302 redirect to the client (you can see with HTTP debuging on the client https://support.f5.com/csp/article/K35932460 ) and maybe not the cookie but as mentioned in previous messages changing the HTTP redirect could help. That is what I can share and hopefully it helps you to investigate your issue.
- AlexS_ybDec 30, 2022Cirrocumulus
You - well I haven't been able to set a cookie during the initial redirect to /my.policy
cookie going to the client not the back end.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com