Wednesday, July 8, 2015

Translate portal to myportal when user is logged in

The Problem

Suppose you have a public-facing site for anonymous portal users. But suppose also that the same site also has some private resources requiring users to authenticate for access.
  • In this scenario, an authenticated user will be logged out if they try to access a public resource that has the anonymous context in the URL (i.e. /wps/portal/... instead of /wps/myportal/...).
  • BUT, we cannot just make all of our links contain /wps/myportal to get around the issue because then anonymous users will be prompted to login even if the resource is public.
  • What we need is a way to let links to public resources contain the anonymous context (/wps/portal/...), but we need to automatically transform that into (/wps/myportal) if the user happens to be logged in.

The Solution

There is a configuration option that does exactly this! Here's how you enable it on WPS 7 or greater.
  • In the Deployment Manager or WAS console, navigate to Resource environment providers > WP ConfigService > Custom properties</li>
  • Look for the property 'uri.home.substitution'. If it's not already in the list, add the property (as type java.lang.String) and set the value to 'true'. If it's already in the list, just set the value to true.</li>
  • Apply and save your changes to the master configuration. In a stand-alone environment, you then need to restart your server. In a clustered environment, you need to synchronize the nodes and then restart the cluster.</li>

Summary

The uri.home.substitution option determines whether a public URL should be translated to a protected URL if a user session exists. It is false by default and can be set to <em>true</em>.


Reference Link: https://wiki.base22.com/display/btg/Translate+portal+to+myportal+when+user+is+logged+in