paulsp 2003/08/10 04:25:45
Modified: applications/demo/src/webapp/WEB-INF portlet.xml
portal/src/webapp/WEB-INF web.xml
portal/src/webapp/WEB-INF/psml/user/anon/html default.psml
Added: applications/demo/src/webapp/WEB-INF/demo/simple Login.jsp
portal/src/webapp LogInRedirector.jsp error.jsp login.jsp
logout.jsp
Log:
Added a login portlet. The authentication is done by the servlet
container, i.e. Tomcat. The JSP's need to be cleanded up, mainly
internationalized, but the functionality is complete.
Revision Changes Path
1.4 +19 -0
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/portlet.xml
Index: portlet.xml
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/portlet.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- portlet.xml 6 Aug 2003 19:51:02 -0000 1.3
+++ portlet.xml 10 Aug 2003 11:25:45 -0000 1.4
@@ -174,5 +174,24 @@
</portlet-info>
</portlet>
+ <portlet id="LoginPortlet">
+ <init-param>
+ <name>ViewPage</name>
+ <value>/WEB-INF/demo/simple/Login.jsp</value>
+ </init-param>
+ <portlet-name>LoginPortlet</portlet-name>
+ <display-name>LoginRequest Portlet Wrapper</display-name>
+ <portlet-class>org.apache.jetspeed.portlet.ServletPortlet</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Login/Logout Request Information</title>
+ <short-title>Portlet Request Information</short-title>
+ </portlet-info>
+ </portlet>
+
</portlet-app>
1.1
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/demo/simple/Login.jsp
Index: Login.jsp
===================================================================
<%@ page language="java"
session="false"
%>
<!--
Copyright (c) 2003 The Apache Software Foundation. All rights
reserved.
@author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
-->
<div>
<%
if (request.getRemoteUser() != null)
{
%>
Welcome <%= request.getRemoteUser() %>
<a href='<%= request.getContextPath() + "/logout.jsp" %>'>Logout</a>
<%
}
else
{
%>
<a href='<%= request.getContextPath() + "/LogInRedirector.jsp" %>'>Login</a>
<%
}
%>
</div>
1.1 jakarta-jetspeed-2/portal/src/webapp/LogInRedirector.jsp
Index: LogInRedirector.jsp
===================================================================
<%
response.sendRedirect(response.encodeURL(""));
%>
1.1 jakarta-jetspeed-2/portal/src/webapp/error.jsp
Index: error.jsp
===================================================================
<html>
<title>Login Error</title>
<body>
<a href='<%= response.encodeURL("index.jsp")%>'>Home</a>
<form method="POST" action='<%= response.encodeURL("j_security_check")%>'>
Username <input type="text" size="15" name="j_username">
<br>
Password <input type="password" size="15" name="j_password">
<input type="submit" value="Login">
</form>
</body>
</html>
1.1 jakarta-jetspeed-2/portal/src/webapp/login.jsp
Index: login.jsp
===================================================================
<html>
<title>Login</title>
<body>
<form method="POST" action='<%= response.encodeURL("j_security_check")%>'>
Username <input type="text" size="15" name="j_username">
<br>
Password <input type="password" size="15" name="j_password">
<input type="submit" value="Login">
</form>
</body>
</html>
1.1 jakarta-jetspeed-2/portal/src/webapp/logout.jsp
Index: logout.jsp
===================================================================
<%
request.getSession().invalidate();
response.sendRedirect("");
%>
1.2 +21 -0 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/web.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- web.xml 28 Jul 2003 23:47:55 -0000 1.1
+++ web.xml 10 Aug 2003 11:25:45 -0000 1.2
@@ -46,4 +46,25 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
+ <!-- Protect LogInRedirectory.jsp. This will require a login when called -->
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Login</web-resource-name>
+ <url-pattern>/LogInRedirector.jsp</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>*</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <!-- Login configuration uses form-based authentication -->
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>Intranet</realm-name>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/error.jsp</form-error-page>
+ </form-login-config>
+ </login-config>
+
</web-app>
1.3 +1 -0
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/psml/user/anon/html/default.psml
Index: default.psml
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/psml/user/anon/html/default.psml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- default.psml 1 Aug 2003 20:16:12 -0000 1.2
+++ default.psml 10 Aug 2003 11:25:45 -0000 1.3
@@ -5,6 +5,7 @@
<title>Welcome to Jetspeed-2</title>
</metainfo>
+ <entry type="ref" name="LoginPortlet" parent="LoginPortlet"/>
<entry type="ref" name="HelloPortlet" parent="HelloPortlet"/>
<entry type="ref" name="DisplayRequestPortlet" parent="DisplayRequestPortlet"/>
<entry type="ref" name="CustomerList" parent="CustomerList"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]