account for registration time in approval page, closes #550
parent
90b10d7bad
commit
376403fa4a
|
@ -4,7 +4,7 @@
|
|||
<%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="o" tagdir="/WEB-INF/tags"%>
|
||||
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<o:header title="Approve Access" />
|
||||
<o:topbar pageName="Approve" />
|
||||
<div class="container main">
|
||||
|
@ -37,8 +37,14 @@
|
|||
<div class="row">
|
||||
<div class="span5 offset1 well-small" style="text-align: left">
|
||||
|
||||
<%-- TODO: wire up to stats engine and customize display of this block --%>
|
||||
<c:if test="${ client.dynamicallyRegistered }">
|
||||
<c:choose>
|
||||
<c:when test="${ gras }">
|
||||
<!-- client is "generally recognized as safe, display a more muted block -->
|
||||
<div><p class="alert alert-info"><i class="icon-globe"></i> This client was dynamically registered.</p></div>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<!-- client is dynamically registered -->
|
||||
<div class="alert alert-block <c:out value="${ count eq 0 ? 'alert-error' : 'alert-warn' }" />">
|
||||
<h4>
|
||||
<i class="icon-globe"></i> Caution:
|
||||
|
@ -47,6 +53,8 @@
|
|||
<span class="label"><c:out value="${ count }" /></span>
|
||||
time<c:out value="${ count == 1 ? '' : 's' }"/> previously.
|
||||
</div>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${ not empty client.logoUri }">
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mitre.oauth2.web;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
@ -181,6 +182,16 @@ public class OAuthConfirmationController {
|
|||
model.put("contacts", contacts);
|
||||
}
|
||||
|
||||
// if the client is over a week old and has more than one registration, don't give such a big warning
|
||||
// instead, tag as "Generally Recognized As Safe (gras)
|
||||
Date lastWeek = new Date(System.currentTimeMillis() + (60 * 60 * 24 * 7 * 1000));
|
||||
//Date lastWeek = new Date(System.currentTimeMillis() - (60 * 60 * 24 * 7 * 1000));
|
||||
if (count > 1 && client.getCreatedAt() != null && client.getCreatedAt().before(lastWeek)) {
|
||||
model.put("gras", true);
|
||||
} else {
|
||||
model.put("gras", false);
|
||||
}
|
||||
|
||||
|
||||
return "approve";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue