enhancements to approval page
parent
ec6a78c1ba
commit
dab52ca8a0
|
@ -19,13 +19,22 @@
|
||||||
<c:remove scope="session" var="SPRING_SECURITY_LAST_EXCEPTION" />
|
<c:remove scope="session" var="SPRING_SECURITY_LAST_EXCEPTION" />
|
||||||
|
|
||||||
<div class="well" style="text-align: center">
|
<div class="well" style="text-align: center">
|
||||||
<h1>Approve New Site</h1>
|
<h1>Approval Required for
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${empty client.clientName}">
|
||||||
|
<em><c:out value="${client.clientId}" /></em>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<em><c:out value="${client.clientName}" /></em>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</h1>
|
||||||
|
|
||||||
<form name="confirmationForm"
|
<form name="confirmationForm"
|
||||||
action="<%=request.getContextPath()%>/authorize" method="post">
|
action="<%=request.getContextPath()%>/authorize" method="post">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span4 offset2 well-small" style="text-align: left">
|
<div class="span5 offset1 well-small" style="text-align: left">
|
||||||
|
|
||||||
<%-- TODO: wire up to stats engine and customize display of this block --%>
|
<%-- TODO: wire up to stats engine and customize display of this block --%>
|
||||||
<c:if test="${ client.dynamicallyRegistered }">
|
<c:if test="${ client.dynamicallyRegistered }">
|
||||||
|
@ -33,8 +42,9 @@
|
||||||
<h4>
|
<h4>
|
||||||
<i class="icon-globe"></i> Caution:
|
<i class="icon-globe"></i> Caution:
|
||||||
</h4>
|
</h4>
|
||||||
This client was dynamically registered and has very few other
|
This software was dynamically registered and has been used by
|
||||||
users on this system.
|
<span class="label"><c:out value="${ count }" /></span>
|
||||||
|
users.
|
||||||
</div>
|
</div>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
|
@ -47,30 +57,40 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</c:if>
|
</c:if>
|
||||||
Do you authorize
|
<div>
|
||||||
"<c:choose>
|
${client.clientDescription}
|
||||||
<c:when test="${empty client.clientName}">
|
</div>
|
||||||
<c:out value="${client.clientId}" />
|
<c:if test="${ (not empty client.clientUri) || (not empty client.policyUri) || (not empty client.tosUri) }">
|
||||||
</c:when>
|
|
||||||
<c:otherwise>
|
|
||||||
<c:out value="${client.clientName}" />
|
|
||||||
</c:otherwise>
|
|
||||||
</c:choose>"
|
|
||||||
to sign you into their site using your identity?
|
|
||||||
<c:if test="${not empty client.clientDescription}">
|
|
||||||
<div>
|
<div>
|
||||||
<a class="small" href="#"onclick="$('#description').toggle('fast'); return false;"><i class="icon-chevron-right"></i> more information</a>
|
<a id="toggleMoreInformation" class="small" href="#"><i class="icon-chevron-right"></i> more information</a>
|
||||||
|
</div>
|
||||||
|
<div id="moreInformation" class="hide">
|
||||||
|
<ul>
|
||||||
|
<c:if test="${ not empty client.clientUri }">
|
||||||
|
<li>Home page: <a href="<c:out value="${ client.clientUri }" />"><c:out value="${ client.clientUri }" /></a>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
|
||||||
<blockquote id="description" style="display: none">
|
|
||||||
${client.clientDescription}
|
|
||||||
</blockquote>
|
|
||||||
</p>
|
|
||||||
</c:if>
|
</c:if>
|
||||||
<div>
|
<div>
|
||||||
<small>
|
<c:choose>
|
||||||
<strong>Redirect URI: </strong><c:out value="${redirect_uri}" />
|
<c:when test="${ empty client.redirectUris }">
|
||||||
</small>
|
<div class="alert alert-block alert-error">
|
||||||
|
<h4>
|
||||||
|
<i class="icon-info-sign"></i> Warning:
|
||||||
|
</h4>
|
||||||
|
This client does not have any redirect URIs registered and could be using a
|
||||||
|
malicious URI. You will be redirected to the following page if you click Approve:
|
||||||
|
<code><c:out value="${redirect_uri}" /></code>
|
||||||
|
</div>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<small>
|
||||||
|
<strong>You will be redirected to the following page
|
||||||
|
if you click Approve: </strong><code><c:out value="${redirect_uri}" /></code>
|
||||||
|
</small>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<c:if test="${ client.subjectType == 'PAIRWISE' }">
|
<c:if test="${ client.subjectType == 'PAIRWISE' }">
|
||||||
|
@ -84,6 +104,16 @@
|
||||||
<fieldset style="text-align: left" class="well">
|
<fieldset style="text-align: left" class="well">
|
||||||
<legend style="margin-bottom: 0;">Access to:</legend>
|
<legend style="margin-bottom: 0;">Access to:</legend>
|
||||||
|
|
||||||
|
<c:if test="${ empty client.scope }">
|
||||||
|
<div class="alert alert-block alert-error">
|
||||||
|
<h4>
|
||||||
|
<i class="icon-info-sign"></i> Warning:
|
||||||
|
</h4>
|
||||||
|
This client does not have any scopes registered and is therefore allowed to
|
||||||
|
request <em>any</em> scopes available on the system. Proceed with caution.
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<c:forEach var="scope" items="${ scopes }">
|
<c:forEach var="scope" items="${ scopes }">
|
||||||
|
|
||||||
<label for="scope_${ scope.value }" class="checkbox">
|
<label for="scope_${ scope.value }" class="checkbox">
|
||||||
|
@ -153,6 +183,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<h3>
|
||||||
|
Do you authorize
|
||||||
|
"<c:choose>
|
||||||
|
<c:when test="${empty client.clientName}">
|
||||||
|
<c:out value="${client.clientId}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<c:out value="${client.clientName}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>"?
|
||||||
|
</h3>
|
||||||
<input id="user_oauth_approval" name="user_oauth_approval" value="true" type="hidden" />
|
<input id="user_oauth_approval" name="user_oauth_approval" value="true" type="hidden" />
|
||||||
<input name="authorize" value="Authorize" type="submit"
|
<input name="authorize" value="Authorize" type="submit"
|
||||||
onclick="$('#user_oauth_approval').attr('value',true)" class="btn btn-success btn-large" />
|
onclick="$('#user_oauth_approval').attr('value',true)" class="btn btn-success btn-large" />
|
||||||
|
@ -170,6 +211,20 @@
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.claim-tooltip').popover();
|
$('.claim-tooltip').popover();
|
||||||
|
|
||||||
|
$('#toggleMoreInformation').on('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
if ($('#moreInformation').is(':visible')) {
|
||||||
|
// hide it
|
||||||
|
$('#moreInformation').hide('fast');
|
||||||
|
$('#toggleMoreInformation i').attr('class', 'icon-chevron-right');
|
||||||
|
} else {
|
||||||
|
// show it
|
||||||
|
$('#moreInformation').show('fast');
|
||||||
|
$('#toggleMoreInformation i').attr('class', 'icon-chevron-down');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//-->
|
//-->
|
||||||
|
|
|
@ -26,11 +26,13 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.mitre.oauth2.model.ClientDetailsEntity;
|
||||||
import org.mitre.oauth2.model.SystemScope;
|
import org.mitre.oauth2.model.SystemScope;
|
||||||
import org.mitre.oauth2.service.ClientDetailsEntityService;
|
import org.mitre.oauth2.service.ClientDetailsEntityService;
|
||||||
import org.mitre.oauth2.service.SystemScopeService;
|
import org.mitre.oauth2.service.SystemScopeService;
|
||||||
import org.mitre.openid.connect.model.UserInfo;
|
import org.mitre.openid.connect.model.UserInfo;
|
||||||
import org.mitre.openid.connect.service.ScopeClaimTranslationService;
|
import org.mitre.openid.connect.service.ScopeClaimTranslationService;
|
||||||
|
import org.mitre.openid.connect.service.StatsService;
|
||||||
import org.mitre.openid.connect.service.UserInfoService;
|
import org.mitre.openid.connect.service.UserInfoService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -39,7 +41,6 @@ import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
|
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
|
||||||
import org.springframework.security.oauth2.provider.AuthorizationRequest;
|
import org.springframework.security.oauth2.provider.AuthorizationRequest;
|
||||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -47,10 +48,6 @@ import org.springframework.web.bind.annotation.SessionAttributes;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
|
||||||
import com.google.common.collect.HashMultimap;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
import com.google.common.collect.Multimaps;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
@ -74,6 +71,9 @@ public class OAuthConfirmationController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StatsService statsService;
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(OAuthConfirmationController.class);
|
private static Logger logger = LoggerFactory.getLogger(OAuthConfirmationController.class);
|
||||||
|
|
||||||
public OAuthConfirmationController() {
|
public OAuthConfirmationController() {
|
||||||
|
@ -102,7 +102,7 @@ public class OAuthConfirmationController {
|
||||||
|
|
||||||
//AuthorizationRequest clientAuth = (AuthorizationRequest) model.remove("authorizationRequest");
|
//AuthorizationRequest clientAuth = (AuthorizationRequest) model.remove("authorizationRequest");
|
||||||
|
|
||||||
ClientDetails client = null;
|
ClientDetailsEntity client = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client = clientService.loadClientByClientId(clientAuth.getClientId());
|
client = clientService.loadClientByClientId(clientAuth.getClientId());
|
||||||
|
@ -129,6 +129,8 @@ public class OAuthConfirmationController {
|
||||||
|
|
||||||
model.put("redirect_uri", redirect_uri);
|
model.put("redirect_uri", redirect_uri);
|
||||||
|
|
||||||
|
|
||||||
|
// pre-process the scopes
|
||||||
Set<SystemScope> scopes = scopeService.fromStrings(clientAuth.getScope());
|
Set<SystemScope> scopes = scopeService.fromStrings(clientAuth.getScope());
|
||||||
|
|
||||||
Set<SystemScope> sortedScopes = new LinkedHashSet<SystemScope>(scopes.size());
|
Set<SystemScope> sortedScopes = new LinkedHashSet<SystemScope>(scopes.size());
|
||||||
|
@ -167,6 +169,11 @@ public class OAuthConfirmationController {
|
||||||
|
|
||||||
model.put("claims", claimsForScopes);
|
model.put("claims", claimsForScopes);
|
||||||
|
|
||||||
|
// client stats
|
||||||
|
Integer count = statsService.countForClientId(client.getId());
|
||||||
|
model.put("count", count);
|
||||||
|
|
||||||
|
|
||||||
return "approve";
|
return "approve";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue