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
- ant new-portlet
- Create a JSR-168 portlet (avoid gridsphere's custom gs portlet)
- set up appropriate configuration parameters in
WEB-INF/portlet.xml
andWEB-INF/layout.xml
- register portlet with
gridsphere/WEB-INF/layout.xml
andgridsphere/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
- create a concrete Portlet class, subtype of
org.gridlab.gridsphere.provider.portlet.jsr.ActionPortlet
- the created portlet must be in aportlets
subpackage, otherwise GridSphere won't find it. You can also subclassAbstractTdarPortlet
, which will probably live in TdarCorePortlet soon. - 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.javapublic 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
- 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.
- GAMA portlet: ~/gridsphere/projects/gama/webapp/WEB-INF/web.xml
- Core Portlet: ~/gridsphere/projects/CorePortlet/webapp/WEB-INF/classes/geon.properties
- 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/
- Of particular relevance: http://www.gridsphere.org/gridsphere/docs-GS-2.2.X/ReferenceGuide/ReferenceGuide.html
- Tag Library: http://www.gridsphere.org/gridsphere/docs-GS-2.2.X/TagGuide/TagGuide.html
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