Search code examples
javawebspherewebsphere-portalibm-was

How i can redirect user to page of Identity Provider in TAI? WebSphere


I'm developing TAI for OpenID Connect purpose. So, I want that user auth in My main mission: on main page of WebSphere Portal (WSP), user press button "Login using Google" (Google just for an example of OpenID Connect Auth), than user redirecting to page, where he is write his credentials of service, next service redirects him to my WSP again where he would be auth success.

I asked about technology (mechanism of WAS) which let me implement this scenario in WebSphere Application Server (WAS) and WebSphere Portal (WSP), the answer is TAI. Now I can't understand how I can redirect user in TAI to specific page and waiting for response. If I wrong with mechanism, please tell me how I can implement it.


Solution

  • WebSphere Portal already supports out of the box log in using OpenID Google, Yahoo, Facebook and others check Integrating with OpenID authentication
    and here for earlier versions How to Configure and Use OpenID, Facebook integration on WebSphere Portal

    Have you seen those? Any reasons you want to implement it by yourself?

    UPDATE

    Try the following code in your TAI (this is only a fragment of TAI, showing only redirect, since complete TAI might be quite complex):

    public class MyTai implements TrustAssociationInterceptor {
        @Override
        public TAIResult negotiateValidateandEstablishTrust(HttpServletRequest req,
                HttpServletResponse res) throws WebTrustAssociationFailedException {
            // pseudo code
            ....
            if(requestShouldRedirect) {
                res.sendRedirect("URL_TO_REDIRECT");
                return TAIResult.create(HttpServletResponse.SC_CONTINUE);
    
            }
            else // finalize authentication
                ....