You are here

JSP to get pdsLoginId (revisited)

Submitted by mleemoore on Wed, 06/19/2013 - 18:56

I have seen several posts prior about using JSP to get the pdsLoginId, but have been unsuccessful as of yet. I have tried using several iterations of the following code. It seems to be an issue of the getAttribute method. I get null returned with any iteration of getAttibute. The getFullName method works fine. We are running Luminis 4.3, and I assume this is uPortal 2.6.1 (according to version.class in uportal.jar). Any help would be appreciated.

private String getThirdPartyID(HttpServletRequest hsr)
throws PortalSecurityException
{
StringBuffer sb = new StringBuffer();
SimplePersonManager spm = new SimplePersonManager();
IPerson i = spm.getPerson(hsr);
sb.append( (String)i.getAttribute("uid"));
return sb.toString();
}

General:

Luminis Version:

To answer my own question the getAttribute line can be changed to the following to obtain the login id...

sb.append( (String)i.getAttribute("urn:sungardhe:dir:loginId"));

I am glad that you found the solution. We do exactly the same - and I intended
posting this a couple of weeks ago. Hopefully I can put the jsp code fragment
onto LDN. (yes i managed, but the nice spacing was lost)

Derek


<%@ page language="java" contentType="text/html" %>

<%-- Import class libraries --%>

<%@ page import="java.util.*" %>
<%@ page import="org.jasig.portal.security.provider.*" %>
<%@ page import="org.jasig.portal.security.*" %>
<%@ page import="org.jasig.portal.RDBMServices" %>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="java.security.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.security.MessageDigest" %>
<%@ page import="java.security.NoSuchAlgorithmException" %>

<%!
private String getUn(HttpServletRequest hsr)
throws PortalSecurityException
{
StringBuffer sb=new StringBuffer();
SimplePersonManager spm=new SimplePersonManager();
IPerson i=spm.getPerson(hsr);
sb.append( (String) i.getAttribute("urn:sungardhe:dir:loginId") );
return sb.toString();
}
%>
<%
/** we also have similar getters for
* Object [] idAllArray = i.getAttributeValues("urn:sgheX:dir:esId");
* Object [] myRoles = i.getAttributeValues("urn:sungardhe:dir:role");
**/

try
{
myUsername = getUn(request);
}
catch (Exception e)
{
out.println(" ");
out.println(" window.location.href = '" + sessionUrl + "';");
out.println("");
out.flush();
}
%>