<?xml version="1.0" encoding="utf-8"?>
<html>
- JhuNavigation is a bad name
- If I had to do this again I probably wouldn't pull the SSO value out of the database, instead I'd pull it from HTTP.
- The 'jhu_authentication' metadata element is not used by the business layer; SSO authentication/authorization has already occurred. The element is there purely to allow stylers to add hints in the UI that the user has authenticated with SSO.
*In retrospect I should have put this in its own aspect instead of modifying the EPerson aspect.
Panel |
---|
... <map:transformers> ... <!-- Adds metadata to the <userMeta> section of the DRI indicating whether or not the user authenticated using single sign on (SiteMinder). --> <map:transformer name="IsSsoLogin" src="edu.jhu.library.dspace.app.xmlui.eperson.JhuNavigation"/> ... </map:transformers> ... <map:pipelines> <map:pipeline> ... <map:transform type="Navigation"/> <!-- If the user is using Johns Hopkins single sign on, then update the <userMeta> element of the DRI document by adding a <metadata> element: <dri:metadata element="jhu_authentication" qualifier="singleSignOn">true</dri:metadata> Themes can take advantage of this to provide additional styling. --> <map:transform type="IsSsoLogin"/> ... |
Panel |
---|
package edu.jhu.library.dspace.app.xmlui.eperson; import edu.jhu.library.dspace.eperson.JhuEpersonDbField; import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer; import org.dspace.app.xmlui.utils.UIException; import org.dspace.app.xmlui.wing.WingException; import org.dspace.app.xmlui.wing.element.UserMeta; import org.dspace.authorize.AuthorizeException; import org.dspace.eperson.EPerson; import org.xml.sax.SAXException; import java.io.IOException; import java.sql.SQLException; /** - Emits JHU-specific Single Sign On information into the DRI.
*/ public class JhuNavigation extends AbstractDSpaceTransformer {
public void addUserMeta( UserMeta userMeta ) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException { EPerson ePerson = context.getCurrentUser(); if ( ePerson != null ) { if ( "true".equalsIgnoreCase( ePerson.getMetadata( JhuEpersonDbField.SSO_LOGIN ) ) ) { userMeta .addMetadata( JhuDri.DRI_AUTHN_ELEMENT, JhuDri.AUTHN_QUALIFIER_SSO ) .addContent( JhuDri.AUTHN_SSO_ENABLED ); } } } } |
</html>