Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine: add scope 'openid' for compatibility with new versions of the keycloak #927

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

public class ExternalOIDCService {

private static final String OPENID_SCOPE = "openid";
private static Logger log = LoggerFactory.getLogger(ExternalOIDCService.class);

// Reference to the HTTP client used to send the requests to the SSO server:
Expand Down Expand Up @@ -125,6 +126,12 @@ private static SsoSession login(SsoContext ssoContext,
String externalOidcClientSecret = ssoContext.getSsoLocalConfig().getProperty("EXTERNAL_OIDC_CLIENT_SECRET");
String scope = SsoService.getScopeRequestParameter(request, "");

// We should request this scope by RFC (https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest)
// to have possibility for working with other oidc endpoints.
if( ! scope.contains(OPENID_SCOPE)) {
scope = scope + " " + OPENID_SCOPE;
}

HttpPost post = createPost(externalOidcTokenEndPoint);
List<BasicNameValuePair> form = new ArrayList<>();
form.add(new BasicNameValuePair("client_id", externalOidcClientId));
Expand Down