Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Configure a login server that will automatically redirect the user to th... #46

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ public class SamlRemoteUaaController extends RemoteUaaController {

@Value("${login.entityID}")
public String entityID = "";

@Value("${login.autoRedirect:false}")
public boolean autoRedirect = false;

@Override
@RequestMapping(value = { "/info", "/login" }, method = RequestMethod.GET)
public String prompts(HttpServletRequest request, @RequestHeader
HttpHeaders headers, Map<String, Object> model, Principal principal) throws Exception {
// Entity ID to start the discovery
model.put("entityID", entityID);
model.put("saml",Boolean.TRUE);
model.put("saml", Boolean.TRUE);
model.put("autoRedirect", autoRedirect);
return super.prompts(request, headers, model, principal);
}

Expand Down
193 changes: 101 additions & 92 deletions login-server/src/main/webapp/WEB-INF/jsp/oss/login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -95,99 +95,108 @@ img.gsc-branding-img,img.gsc-branding-img-noclear,img.gcsc-branding-img,img.gcsc
}
})();
</script>
<c:if test="${autoRedirect}">
<script type="text/javascript">
setTimeout(function () {
window.location.href = "saml/discovery?returnIDParam=idp&entityID=${entityID}";
}, 5);
</script>
</c:if>
</head>
<body id="micro">
<div class="splash">
<a href='${links.home}/'><img
alt="Cloud Foundry: The Industry's Open Platform As A Service"
class="logo" src='${baseUrl}/images/logo-cloudfoundry.png'></img> </a>
<div class="splash-box">
<div class="container">
<form id="loginForm" name="loginForm"
action="<c:url value="/login.do"/>" method="POST" novalidate>
<div>
<c:if test="${not empty param.error}">
<div class="alert base alert-error alert-inline">
<div>Unable to verify, please try again:</div>
</div>
</c:if>
<p class="intro-text">Log in to Pivotal CF:</p>
<c:forEach items="${prompts}" var="prompt">
<c:if test="${'passcode' != prompt.key}">
<spring:message code="prompt.${prompt.key}"
text="${prompt.value[1]}" var="text"/>
<input id='${prompt.key}' type='${prompt.value[0]}' ${prompt.value[0]=='password'?'autocomplete="off"':''}
name='${prompt.key}' placeholder='${text}' />
</c:if>
</c:forEach>
</div>
<button type="submit" class="button-orange">Log in</button>
<span class="button-alt"><a href="${links.passwd}">Forgot password &raquo;</a><a href="${links.register}">Create an account &raquo;</a></span>
</form>
<c:if test="${saml}">
<p><a href="saml/discovery?returnIDParam=idp&entityID=${entityID}">Sign in with your organization's credentials.</a></p>
</c:if>
<c:if test="${!autoRedirect}">
<body id="micro">
<div class="splash">
<a href='${links.home}/'><img
alt="Cloud Foundry: The Industry's Open Platform As A Service"
class="logo" src='${baseUrl}/images/logo-cloudfoundry.png'></img> </a>
<div class="splash-box">
<div class="container">
<form id="loginForm" name="loginForm"
action="<c:url value="/login.do"/>" method="POST" novalidate>
<div>
<c:if test="${not empty param.error}">
<div class="alert base alert-error alert-inline">
<div>Unable to verify, please try again:</div>
</div>
</c:if>
<p class="intro-text">Log in to Pivotal CF:</p>
<c:forEach items="${prompts}" var="prompt">
<c:if test="${'passcode' != prompt.key}">
<spring:message code="prompt.${prompt.key}"
text="${prompt.value[1]}" var="text"/>
<input id='${prompt.key}' type='${prompt.value[0]}' ${prompt.value[0]=='password'?'autocomplete="off"':''}
name='${prompt.key}' placeholder='${text}' />
</c:if>
</c:forEach>
</div>
<button type="submit" class="button-orange">Log in</button>
<span class="button-alt"><a href="${links.passwd}">Forgot password &raquo;</a><a href="${links.register}">Create an account &raquo;</a></span>
</form>
<c:if test="${saml}">
<p><a href="saml/discovery?returnIDParam=idp&entityID=${entityID}">Sign in with your organization's credentials.</a></p>
</c:if>
</div>
</div>
<div class="footer"
title="Version: ${app.version}, Commit: ${commit_id}, Timestamp: ${timestamp}, UAA: ${links.uaa}">
&copy;
<fmt:formatDate value="<%=new java.util.Date()%>" pattern="yyyy" />
Pivotal Software, Inc. All rights reserved.
</div>

</div>
<div class="footer"
title="Version: ${app.version}, Commit: ${commit_id}, Timestamp: ${timestamp}, UAA: ${links.uaa}">
&copy;
<fmt:formatDate value="<%=new java.util.Date()%>" pattern="yyyy" />
Pivotal Software, Inc. All rights reserved.
</div>

</div>

<%-- Clear out session scoped attributes, don't leak info --%>
<c:if
test="${not empty sessionScope['SPRING_SECURITY_LAST_EXCEPTION']}">
<c:set scope="session" var="SPRING_SECURITY_LAST_EXCEPTION"
value="${null}" />
</c:if>
<c:if test="${not empty sessionScope['SPRING_SECURITY_LAST_USERNAME']}">
<c:set scope="session" var="SPRING_SECURITY_LAST_USERNAME"
value="${null}" />
</c:if>

<!--
Start of DoubleClick Floodlight Tag: Please do not remove
Activity name of this tag: Micro Cloud Foundry - Landing Page Arrival
URL of the webpage where the tag is expected to be placed: https://www.cloudfoundry.com/micro
This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
Creation Date: 08/18/2011
-->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document
.write('<iframe src="https://fls.doubleclick.net/activityi;src=2645750;type=cloud806;cat=micro467;ord='
+ a
+ '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe
src="https://fls.doubleclick.net/activityi;src=2645750;type=cloud806;cat=micro467;ord=1?"
width="1" height="1" frameborder="0" style="display: none"></iframe>
</noscript>
<!-- End of DoubleClick Floodlight Tag: Please do not remove -->

<c:if test="${not empty analytics}">
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o), m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script',
'//www.google-analytics.com/analytics.js', 'ga');

ga('create', '${analytics.code}', '${analytics.domain}');
ga('send', 'pageview');
</script>
</c:if>
</body>

<%-- Clear out session scoped attributes, don't leak info --%>
<c:if
test="${not empty sessionScope['SPRING_SECURITY_LAST_EXCEPTION']}">
<c:set scope="session" var="SPRING_SECURITY_LAST_EXCEPTION"
value="${null}" />
</c:if>
<c:if test="${not empty sessionScope['SPRING_SECURITY_LAST_USERNAME']}">
<c:set scope="session" var="SPRING_SECURITY_LAST_USERNAME"
value="${null}" />
</c:if>

<!--
Start of DoubleClick Floodlight Tag: Please do not remove
Activity name of this tag: Micro Cloud Foundry - Landing Page Arrival
URL of the webpage where the tag is expected to be placed: https://www.cloudfoundry.com/micro
This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
Creation Date: 08/18/2011
-->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document
.write('<iframe src="https://fls.doubleclick.net/activityi;src=2645750;type=cloud806;cat=micro467;ord='
+ a
+ '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe
src="https://fls.doubleclick.net/activityi;src=2645750;type=cloud806;cat=micro467;ord=1?"
width="1" height="1" frameborder="0" style="display: none"></iframe>
</noscript>
<!-- End of DoubleClick Floodlight Tag: Please do not remove -->

<c:if test="${not empty analytics}">
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o), m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script',
'//www.google-analytics.com/analytics.js', 'ga');

ga('create', '${analytics.code}', '${analytics.domain}');
ga('send', 'pageview');
</script>
</c:if>
</body>
</c:if>
</html>
Loading