<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="org.crosswire.utils.Sessions" %> <%@ page import="org.crosswire.community.RightsAndRoles" %> <%@ page import="org.crosswire.community.RightsAndRoles.User" %> <% String help=request.getParameter("help"); if (help == null) { try { //String sessionHash = Sessions.getSessionHash(request); // Here we're using RightsAndRoles getCurrentSession as this gives us an opportunity to // open a session if we find that the hosting portal has an open session String sessionHash = RightsAndRoles.getInstance().getCurrentSession(request, response); String iframeResponse = request.getParameter("ir"); if (iframeResponse != null) { response.setContentType("text/html"); if (sessionHash == null) sessionHash = ""; String callback = iframeResponse.replace("{s}", sessionHash); if (callback.equals(iframeResponse)) callback = iframeResponse + "(" + sessionHash + ");"; %> <% return; } String redirURL = request.getParameter("r"); if (redirURL != null) { redirURL += (redirURL.indexOf("?") > -1) ? "&" : "?"; redirURL += "vmrcreSession="+sessionHash; response.sendRedirect(redirURL); return; } if (sessionHash != null) { response.setContentType("text/xml"); String userName = (String)Sessions.getInstance().getSessionAttribute(sessionHash, "userName"); User user = RightsAndRoles.getInstance().getUser(userName); if (user != null) { %> <%= user %> <% } else { %> <% } return; } response.setContentType("text/xml"); %> <% return; } catch (Exception e) { e.printStackTrace(); %> <% return; } } %>

auth/session/check

Check if session is established and not stale

Parameters

sessionHashsession hash given from auth/session/open