1 <h2>WSO2 Carbon Authentication Demo</h2>
2
3 <p>
4 This demo shows how to integrate your Web application with the Carbon authentication mechanism.
5 </p>
6 <%
7 Object failed = request.getParameter("failed");
8 if (failed != null) {
9 response.addHeader("logged-in", "false");
10 %>
11 <p><font color="red">Login Failed!</font></p>
12 <%
13 }
14 %>
15 <%
16 if (request.getParameter("logout") == null && session.getAttribute("logged-in") != null) {
17 String userName = (String) session.getAttribute("username");
18 response.addHeader("logged-in", "true");
19 response.addHeader("username", userName);
20 response.addHeader("logged-in-with-role", (String) session.getAttribute("logged-in-with-role"));
21 %>
22 <p>
23 Welcome <%= userName %> <a href="index.jsp?logout=true">Logout</a>
24 </p>
25 <%
26 return;
27 } else {
28 if (request.getParameter("logout") != null) {
29 session.invalidate();
30 response.addHeader("logged-out", "true");
31 }
32 %>
33 <form action="login.jsp" name="loginFrm" method="POST">
34 <table>
35 <tr>
36 <td>Username</td>
37 <td><input type="text" name="username"/></td>
38 </tr>
39 <tr>
40 <td>Password</td>
41 <td><input type="password" name="password"/></td>
42 </tr>
43 <tr>
44 <td colspan="2"> </td>
45 </tr>
46 <tr>
47 <td> </td>
48 <td><input type="submit" value="Login"/></td>
49 </tr>
50 </table>
51 </form>
52 <%
53 }
54 %>