Skip to content

Commit 3a73e70

Browse files
committed
Merge remote-tracking branch 'origin/version_4.3.0' into version_4.3.0
2 parents f3ab227 + c406906 commit 3a73e70

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

Server/src/main/java/org/gluu/oxauth/authorize/ws/rs/ConsentGathererService.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
import org.gluu.jsf2.service.FacesService;
1010
import org.gluu.model.custom.script.conf.CustomScriptConfiguration;
1111
import org.gluu.oxauth.i18n.LanguageBean;
12+
import org.gluu.oxauth.model.authorize.AuthorizeRequestParam;
13+
import org.gluu.oxauth.model.authorize.ScopeChecker;
1214
import org.gluu.oxauth.model.common.SessionId;
1315
import org.gluu.oxauth.model.config.Constants;
1416
import org.gluu.oxauth.model.configuration.AppConfiguration;
1517
import org.gluu.oxauth.service.AuthorizeService;
1618
import org.gluu.oxauth.service.ClientService;
19+
import org.gluu.oxauth.service.SessionIdService;
1720
import org.gluu.oxauth.service.common.UserService;
1821
import org.gluu.oxauth.service.external.ExternalConsentGatheringService;
1922
import org.gluu.oxauth.service.external.context.ConsentGatheringContext;
@@ -69,6 +72,12 @@ public class ConsentGathererService {
6972

7073
@Inject
7174
private ClientService clientService;
75+
76+
@Inject
77+
private SessionIdService sessionIdService;
78+
79+
@Inject
80+
private ScopeChecker scopeChecker;
7281

7382
private final Map<String, String> pageAttributes = new HashMap<String, String>();
7483
private ConsentGatheringContext context;
@@ -295,4 +304,17 @@ public ConsentGatheringContext getContext() {
295304
return context;
296305
}
297306

307+
public List<org.oxauth.persistence.model.Scope> getScopes() {
308+
if (context == null) {
309+
return Collections.emptyList();
310+
}
311+
312+
SessionId authenticatedSessionId = sessionIdService.getSessionId();
313+
// Fix the list of scopes in the authorization page. oxAuth #739
314+
Set<String> grantedScopes = scopeChecker.checkScopesPolicy(context.getClient(), authenticatedSessionId.getSessionAttributes().get(AuthorizeRequestParam.SCOPE));
315+
String allowedScope = org.gluu.oxauth.model.util.StringUtils.implode(grantedScopes, " ");
316+
317+
return authorizeService.getScopes(allowedScope);
318+
}
319+
298320
}

Server/src/main/webapp/authz/authorize.xhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</f:metadata>
1212

1313
<ui:param name="_client" value="#{consentGatherer.context.client}" />
14-
<ui:param name="_scopes" value="#{authorizeService.scopes}" />
14+
<ui:param name="_scopes" value="#{consentGatherer.scopes}" />
1515

1616
<ui:define name="controlButttons">
1717
<h:commandLink id="doNotAllowButton" class="button button-default"

0 commit comments

Comments
 (0)