External Links to Channels and tabs
External Links to Channels and tabs (v2.5)
There are several ideas and requirements that have been voiced about enabling external links that come into uPortal and "land" directly on a channel in focus mode or on a tab both in guest mode and as an authenticated user.
Linking directly to a channel through login
For information on how to go directly to a channel in focus mode as an authenticated user see this page: 05 Focus a channel
Linking directly to a channel in guest mode
To go to a channel in focus mode and in guest mode you also need a patch to allow transient layout wrapper to be handled by the guest preferences and modifications to session manager and login processing to handle passing parameters across session boundaries. The attachment deepLinkingForGuestPatch2-5-1.txt contains this patch for the 2.5.1 RC1 code.
The UserLayoutManagerFactory was refactored for this patch. This class is used to retrieve the layout manager implementation via the method getUserLayoutManager(IPerson person, UserProfile profile) when a layout manager implementation is requested for a logged in user. The orginal version of this method always wraps the layout manager implementation inside a TransientUserLayoutManager. This is fine for authenticated users. However, a separate method, immutableUserLayoutManager(IUserLayoutManager man), is used by GuestUserPreferencesManager to add the immutable wrapper for guest users. So in the unmodified code a guest layout manager is layered like this:
- ImmutableLayoutManager
- TransientLayoutManager
- "real" layout manager as specified by properties file
- TransientLayoutManager
In order for deep linking to work properly the transient layout manager wrapper should be on the outside like this:
- TransientLayoutManager
- ImmutableLayoutManager
- "real" layout manager as specified by properties file
- ImmutableLayoutManager
This patch adds a new public method getCoreUserLayoutManager(IPerson person, UserProfile profile) to the Layout Manager Factory. The new mwthod returns only the "real" layout manager. This allows GuestUserPreferencesManager to get the layout manager with the Transient Layout Manager "on the outside". In order to avoid duplication of code the getUserLayoutManager method was also reafactored to use the new method internally.
Hint
Links to channels in guest mode work only with a url which contains the tag element such as: https://portal.yale.edu/tag.idempotent.render.userLayoutRootNode.uP?uP_fname=general-search
Servlets for deep links in guest mode
Servlet GuestServlet.java handles deep links in guest mode. It was inspired by LoginServlet, where authentication stuff has been removed. To use it, insert the following lines to web.xml in your uPortal hierarchy:
<servlet> <servlet-name>Guest</servlet-name> <servlet-class>org.jasig.portal.GuestServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Guest</servlet-name> <url-pattern>/Guest</url-pattern> </servlet-mapping>
Links can then look like:
http://server/uPortal_path/Guest?uP_fname=xxx&uP_args=yyy.
As well as LoginServlet, GuestServlet invalidates the current HTTP session (and creates a new one). Servlet PersistentGuestServlet.java extends GuestServlet.java to preserve some attributes (the attributes with name starting by 'uP_pers_'). Attributes are saved by class PersistentAttributesSaver.java.
Note
Note that developers using servlet PersistentGuestServlet.java should be aware that storing critical information (such as passwords) in session attributes starting with 'uP_pers_' is a potential security hole (as these attributes will pass through HTTP sessions).
Those contributions are currently used in channel esup-helpdesk (http://esup-helpdesk.sourceforge.net) and we would be pleased if this code was integrated into the main uPortal distribution.
External Links to Channels and tabs (v2.6)
The GuestServlet.java is unchanged, but GuestUserPreferencesManager.java was modified to pass the uP_args parameter in addition to uP_fname.