GridSphere

Hacking GridSphere authentication

GridSphereServlet.login(GridSphereEvent event)

appears to be the section of code we need to modify if we want to use Crowd authentication. Then, rebuild gridsphere.jar and deploy it along with the tdar.

        PortletRequest req = event.getPortletRequest();
        PortletResponse response = event.getPortletResponse();
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        HttpAuthenticator authenticator = HttpAuthenticatorFactory.getHttpAuthenticator();
        try {
            authenticator.authenticate(req, response, username, password);
        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvalidAuthorizationTokenException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvalidAuthenticationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InactiveAccountException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

How-tos

How to make a new portlet

  1. ant new-portlet
  2. Create a JSR-168 portlet (avoid gridsphere's custom gs portlet)
  3. set up appropriate configuration parameters in WEB-INF/portlet.xml and WEB-INF/layout.xml
  4. register portlet with gridsphere/WEB-INF/layout.xml and gridsphere/WEB-INF/CustomPortal/layout/groups/gridsphere.xml
    Example:
     <portlet-tab label="tdaregister">
            <title lang="en">Register</title>
            <portlet-tabbed-pane style="sub-menu">
                <portlet-tab label="TDAR Project/Data Registration">
                    <title lang="en">TDAR Project/Data Registration</title>
                    <table-layout>
                    <row-layout>
                        <column-layout width="100%">
                            <portlet-frame label="tdaregister">
                                <portlet-class>org.tdar.portlets.ProjectRegistrationPortlet</portlet-class>
                            </portlet-frame>
                        </column-layout>
                    </row-layout>
                    </table-layout>
                </portlet-tab>
            </portlet-tabbed-pane>
        </portlet-tab>
    

How to set up the JSR-168 portlet

  1. create a concrete Portlet class, subtype of org.gridlab.gridsphere.provider.portlet.jsr.ActionPortlet - the created portlet must be in a portlets subpackage, otherwise GridSphere won't find it. You can also subclass AbstractTdarPortlet, which will probably live in TdarCorePortlet soon.
  2. in the init(PortletConfig config) method, assign DEFAULT_VIEW_PAGE to the method you want to invoke when the first portlet is encountered. For instance,
    org.tdar.portlets.ProjectRegistrationPortlet.java
    public void init(PortletConfig config) throws PortletException {
        super.init(config);
        DEFAULT_VIEW_PAGE = "listProjects";
    }
    
    public void listProjects(RenderFormEvent event) {
        setNextState(event.getRenderRequest(), LIST_PROJECTS_JSP);
    }
    

How to deploy GEON in a test environment

  1. In order to create accounts you will need to change the SMTP host in several places. After logging in as root, you will need to change the SMTP host under the first Administration tab in the "Configure portal mail settings" portlet.
  2. GAMA portlet: ~/gridsphere/projects/gama/webapp/WEB-INF/web.xml
  3. Core Portlet: ~/gridsphere/projects/CorePortlet/webapp/WEB-INF/classes/geon.properties
  4. Attribute Authorization Portlet: ~/gridsphere/projects/attrauth/webapp/WEB-INF/classes/attrauth.properties

Spring Portlets docs: http://static.springframework.org/spring/docs/2.5.x/reference/portlet.html
Hibernate docs: http://hibernate.org
EJB Persistence Annotations docs: http://java.sun.com/javaee/5/docs/tutorial/doc/bnbpz.html

Gridsphere docs page: http://www.gridsphere.org/gridsphere/gridsphere/guest/docsTab/r/

DeveloperWorks article on how to develop portlets for Gridsphere: http://www.ibm.com/developerworks/grid/library/gr-portlets/

Good overview of portlet/servlet technology: http://dhruv.uits.indiana.edu/portals/portals-101.pdf

Gridsphere, Webwork, and Portlets? http://ieeexplore.ieee.org/Xplore/login.jsp?url=/iel5/9268/29441/01333397.pdf

Spring Web MVC Portlets: http://static.springframework.org/spring/docs/2.5.x/reference/mvc.html