Skip to content

Commit

Permalink
SES-49 Updating JSPs to make sure they are correctly displayed in all…
Browse files Browse the repository at this point in the history
… browsers
  • Loading branch information
vschafer committed Mar 26, 2011
1 parent 5528274 commit b51b68d
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ public void commence(HttpServletRequest request, HttpServletResponse response, A

if (!ecpRequest && idpSelectionPath != null && !isLoginRequest(request)) {

logger.debug("Initializing IDP selection");
request.getRequestDispatcher(idpSelectionPath).include(request, response);
initializeSelection(request, response);

} else {

Expand Down Expand Up @@ -171,6 +170,23 @@ public void commence(HttpServletRequest request, HttpServletResponse response, A

}

/**
* Method is expected to initialize IDP selection in the client's browser by including appropriate source. By default
* page located at idpSelectionPath is included.
*
* @param request request
* @param response response
* @throws ServletException error
* @throws IOException io error
*/
protected void initializeSelection(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

logger.debug("Initializing IDP selection");
response.setContentType("text/html");
request.getRequestDispatcher(idpSelectionPath).include(request, response);

}

/**
* Analyzes the request headers in order to determine if it comes from an ECP-enabled
* client and based on this decides whether ECP profile will be used. Subclasses can override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public void testIDPSelection() throws Exception {
entryPoint.setIdpSelectionPath("/selectIDP");
expect(request.getParameter(SAMLEntryPoint.LOGIN_PARAMETER)).andReturn("false");
expect(request.getRequestDispatcher("/selectIDP")).andReturn(dispatcher);
expect(request.getHeader("Accept")).andReturn(
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
expect(request.getHeader("Accept")).andReturn("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
expect(request.getHeader(org.springframework.security.saml.SAMLConstants.PAOS_HTTP_HEADER)).andReturn(null);
response.setContentType("text/html");
dispatcher.include(request, response);

replay(dispatcher);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="java.util.Set" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Spring Security SAML Extension - Metadata</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Spring Security SAML Extension - Metadata</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Spring Security SAML Extension - Metadata</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Spring Security SAML Extension - Metadata</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

Expand Down
36 changes: 23 additions & 13 deletions spring-security-saml/saml2-sample/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<%@ page import="org.springframework.security.saml.SAMLCredential" %>
<%@ page import="org.springframework.security.core.context.SecurityContextHolder" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>User authenticated</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

<h1>User has been authenticated</h1>

Expand Down Expand Up @@ -38,18 +45,18 @@
<tr>
<td colspan="2"><b>Principal's Attributes</b></td>
</tr>

<c:forEach var="attribute"
items="${credential.attributes}">
<tr>
<td width="300"><c:out value="${attribute.friendlyName}"/></td>
<td>
<c:forEach var="attributeValue"
items="${attribute.attributeValues}">
<c:out value="${attributeValue.value}"/>&nbsp;
</c:forEach>
</td>
</tr>
<tr>
<td width="300"><c:out value="${attribute.friendlyName}"/></td>
<td>
<c:forEach var="attributeValue"
items="${attribute.attributeValues}">
<c:out value="${attributeValue.value}"/>&nbsp;
</c:forEach>
</td>
</tr>
</c:forEach>
</table>
</p>
Expand Down Expand Up @@ -136,11 +143,14 @@
</table>
</p>

<p>
<a href="<c:url value="/saml/logout"/>">Global Logout</a><br />
<p>
<a href="<c:url value="/saml/logout"/>">Global Logout</a><br/>
<a href="<c:url value="/saml/logout?local=true"/>">Local Logout</a>
</p>

<p>
<a href="<c:url value="/saml/web/metadata"/>">Metadata information</a>
</p>
</p>

</body>
</html>
8 changes: 6 additions & 2 deletions spring-security-saml/saml2-sample/src/main/webapp/logout.jsp
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Logout</title></head>
<head>
<title>Logout</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

<p>
You have been logged out
You have been logged out.
</p>

<p>
Expand Down

0 comments on commit b51b68d

Please sign in to comment.