Make user session available via public API, finishes off SIDP-296
[java-idp.git] / src / main / webapp / login.jsp
1 <%@ page import="edu.internet2.middleware.shibboleth.idp.authn.LoginContext" %>
2 <%@ page import="edu.internet2.middleware.shibboleth.idp.session.*" %>
3 <%@ page import="edu.internet2.middleware.shibboleth.idp.util.HttpServletHelper" %>
4 <%@ page import="org.opensaml.saml2.metadata.*" %>
5
6 <%
7     LoginContext loginContext = HttpServletHelper.getLoginContext(HttpServletHelper.getStorageService(application),
8                                                                   application, request);
9                                                                   
10     EntityDescriptor entityDescriptor = HttpServletHelper.getRelyingPartyMetadata(loginContext.getRelyingPartyId(),
11                                                    HttpServletHelper.getRelyingPartyConfirmationManager(application)); 
12                                                     
13     Session userSession = HttpServletHelper.getUserSession(request);
14 %>
15
16 <html>
17
18     <head>
19         <title>Shibboleth Identity Provider - Login</title>
20     </head>
21
22         <body>
23                 <img src="<%= request.getContextPath() %>/images/logo.jpg" />
24                 <h2>Shibboleth Identity Provider Login to Service Provider <%= entityDescriptor.getEntityID() %></h2>
25                 <p>
26         Existing Session: <%= userSession != null %><br/>       
27                 Requested Authentication Methods: <%= loginContext.getRequestedAuthenticationMethods() %><br/>
28                 Attempting Authentication Method: <%= loginContext.getAttemptedAuthnMethod() %> <br/>
29                 Is Forced Authentication: <%= loginContext.isForceAuthRequired() %><br/>
30                 </p>
31                 
32                 <% if ("true".equals(request.getAttribute("loginFailed"))) { %>
33                 <p><font color="red">Authentication Failed</font></p>
34                 <% } %>
35                 
36                 <% if(request.getAttribute("actionUrl") != null){ %>
37                     <form action="<%=request.getAttribute("actionUrl")%>" method="post">
38                 <% }else{ %>
39                     <form action="j_security_check" method="post">
40                 <% } %>
41                 <table>
42                         <tr>
43                                 <td>Username:</td>
44                                 <td><input name="j_username" type="text" tabindex="1" /></td>
45                         </tr>
46                         <tr>
47                                 <td>Password:</td>
48                                 <td><input name="j_password" type="password" tabindex="2" /></td>
49                         </tr>
50                         <tr>
51                                 <td colspan="2"><input type="submit" value="Login" tabindex="3" /></td>
52                         </tr>
53                 </table>
54                 </form>
55         </body>
56         
57 </html>