Skip to content

Commit

Permalink
feat(jans-lock): redirect for consent if external script is enabled a… (
Browse files Browse the repository at this point in the history
#10771)

feat(jans-lock): redirect for consent if external script is enabled and client is not authorized

Signed-off-by: Yuriy Movchan <[email protected]>
  • Loading branch information
yurem authored Jan 31, 2025
1 parent ba5de5b commit c3e4a97
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

import static io.jans.as.server.authorize.ws.rs.AuthzRequestService.canLogWebApplicationException;
import static org.apache.commons.lang3.BooleanUtils.isTrue;
import static org.apache.commons.lang3.BooleanUtils.isFalse;
import static org.apache.commons.lang3.BooleanUtils.toBoolean;

/**
Expand Down Expand Up @@ -174,6 +175,9 @@ public class AuthorizeRestWebServiceImpl implements AuthorizeRestWebService {
@Inject
private ExternalResourceOwnerPasswordCredentialsService externalResourceOwnerPasswordCredentialsService;

@Inject
private ExternalConsentGatheringService externalConsentGatheringService;

@Inject
private DpopService dpopService;

Expand Down Expand Up @@ -604,7 +608,10 @@ private void checkPromptConsent(AuthzRequest authzRequest, SessionId sessionUser
return;
}

if (authzRequest.getPromptList().contains(Prompt.CONSENT) || !isTrue(sessionUser.isPermissionGrantedForClient(authzRequest.getClientId()))) {
if (authzRequest.getPromptList().contains(Prompt.CONSENT) || (!isTrue(sessionUser.isPermissionGrantedForClient(authzRequest.getClientId())) || externalConsentGatheringService.isEnabled())) {
if (!authzRequest.getPromptList().contains(Prompt.CONSENT) && isTrue(sessionUser.isPermissionGrantedForClient(authzRequest.getClientId()))) {
return;
}
if (!clientAuthorizationFetched) {
clientAuthorization = clientAuthorizationsService.find(user.getAttribute("inum"), authzRequest.getClient().getClientId());
}
Expand Down

0 comments on commit c3e4a97

Please sign in to comment.