1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.jetspeed.login; |
18 |
|
|
19 |
|
import java.io.IOException; |
20 |
|
|
21 |
|
import javax.servlet.ServletException; |
22 |
|
import javax.servlet.http.HttpServlet; |
23 |
|
import javax.servlet.http.HttpServletRequest; |
24 |
|
import javax.servlet.http.HttpServletResponse; |
25 |
|
import javax.servlet.http.HttpSession; |
26 |
|
|
27 |
|
import org.apache.jetspeed.Jetspeed; |
28 |
|
import org.apache.jetspeed.PortalReservedParameters; |
29 |
|
import org.apache.jetspeed.audit.AuditActivity; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
0 |
public class LoginRedirectorServlet extends HttpServlet |
38 |
|
{ |
39 |
|
|
40 |
|
public void doGet(HttpServletRequest request, |
41 |
|
HttpServletResponse response) throws IOException, ServletException |
42 |
|
{ |
43 |
0 |
HttpSession session = request.getSession(true); |
44 |
0 |
String destination = (String) session |
45 |
|
.getAttribute(LoginConstants.DESTINATION); |
46 |
0 |
if (destination == null || destination.equals(request.getContextPath())) |
47 |
0 |
destination = request.getContextPath() + "/"; |
48 |
|
else |
49 |
0 |
session.removeAttribute(LoginConstants.DESTINATION); |
50 |
|
|
51 |
0 |
String username = (String)session.getAttribute(LoginConstants.USERNAME); |
52 |
|
|
53 |
0 |
session.removeAttribute(LoginConstants.USERNAME); |
54 |
0 |
session.removeAttribute(LoginConstants.PASSWORD); |
55 |
0 |
session.removeAttribute(LoginConstants.RETRYCOUNT); |
56 |
0 |
session.removeAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE); |
57 |
|
|
58 |
0 |
AuditActivity audit = (AuditActivity)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity"); |
59 |
0 |
if (audit != null) |
60 |
|
{ |
61 |
0 |
audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "Active Authentication"); |
62 |
|
} |
63 |
0 |
response.sendRedirect(response.encodeURL(destination)); |
64 |
0 |
} |
65 |
|
|
66 |
|
public final void doPost(HttpServletRequest request, |
67 |
|
HttpServletResponse response) throws IOException, ServletException |
68 |
|
{ |
69 |
0 |
doGet(request, response); |
70 |
0 |
} |
71 |
|
} |