implemented prompt=consent

pull/324/merge
Justin Richer 2013-04-24 14:08:14 -04:00
parent ce2c90fb30
commit 7292766b51
2 changed files with 41 additions and 33 deletions

View File

@ -125,6 +125,13 @@ public class TofuUserApprovalHandler implements UserApprovalHandler {
String clientId = authorizationRequest.getClientId();
ClientDetails client = clientDetailsService.loadClientByClientId(clientId);
// find out if we're supposed to prompt the user or not
String prompt = authorizationRequest.getAuthorizationParameters().get("prompt");
if (!"consent".equals(prompt)) {
// if the prompt parameter is set to "consent" then we can't use approved sites or whitelisted sites
// otherwise, we need to check them below
//lookup ApprovedSites by userId and clientId
Collection<ApprovedSite> aps = approvedSiteService.getByClientIdAndUserId(clientId, userId);
for (ApprovedSite ap : aps) {
@ -159,6 +166,7 @@ public class TofuUserApprovalHandler implements UserApprovalHandler {
return ar;
}
}
// This must be re-parsed here because SECOAUTH forces us to call things in a strange order
boolean approved = Boolean.parseBoolean(authorizationRequest.getApprovalParameters().get("user_oauth_approval"));