scope comparison for TofuUserApprovalHandler
parent
1c4c53f252
commit
85533d50cf
|
@ -22,10 +22,10 @@ import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.mitre.oauth2.model.SystemScope;
|
|
||||||
import org.mitre.oauth2.service.SystemScopeService;
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.mitre.oauth2.model.SystemScope;
|
||||||
|
import org.mitre.oauth2.service.SystemScopeService;
|
||||||
import org.mitre.openid.connect.model.ApprovedSite;
|
import org.mitre.openid.connect.model.ApprovedSite;
|
||||||
import org.mitre.openid.connect.model.WhitelistedSite;
|
import org.mitre.openid.connect.model.WhitelistedSite;
|
||||||
import org.mitre.openid.connect.service.ApprovedSiteService;
|
import org.mitre.openid.connect.service.ApprovedSiteService;
|
||||||
|
@ -41,9 +41,7 @@ import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,13 +199,14 @@ public class TofuUserApprovalHandler implements UserApprovalHandler {
|
||||||
//registered allowed scopes.
|
//registered allowed scopes.
|
||||||
|
|
||||||
String scope = approvalParams.get(key);
|
String scope = approvalParams.get(key);
|
||||||
String baseScope = systemScopes.baseScopeString(scope);
|
Set<String> approveSet = Sets.newHashSet(scope);
|
||||||
SystemScope structured = systemScopes.toStructuredScope(scope);
|
|
||||||
|
|
||||||
//Make sure this scope is allowed for the given client
|
//Make sure this scope is allowed for the given client
|
||||||
if (client.getScope().contains(baseScope)) {
|
if (systemScopes.scopesMatch(client.getScope(), approveSet)) {
|
||||||
|
|
||||||
// If it's structured, assign the user-specified parameter
|
// If it's structured, assign the user-specified parameter
|
||||||
if (structured != null){
|
SystemScope systemScope = systemScopes.getByValue(scope);
|
||||||
|
if (systemScope.isStructured()){
|
||||||
String paramValue = approvalParams.get("scopeparam_" + scope);
|
String paramValue = approvalParams.get("scopeparam_" + scope);
|
||||||
allowedScopes.add(scope + ":"+paramValue);
|
allowedScopes.add(scope + ":"+paramValue);
|
||||||
// .. and if it's unstructured, we're all set
|
// .. and if it's unstructured, we're all set
|
||||||
|
|
Loading…
Reference in New Issue