Skip to content

Commit

Permalink
Retrieve ClientConnection by invoking getConnection() instead of getC…
Browse files Browse the repository at this point in the history
…ontextObject()

Closes #25231

(cherry picked from commit 0e535d2)

Signed-off-by: Fouad Almalki <me@fouad.io>
Co-authored-by: Fouad Almalki <me@fouad.io>
  • Loading branch information
mposolda and Eng-Fouad committed Dec 15, 2023
1 parent eeebae6 commit 2b0c91a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected ClientModel authenticateClient() {
}

protected void checkSsl() {
ClientConnection clientConnection = session.getContext().getContextObject(ClientConnection.class);
ClientConnection clientConnection = session.getContext().getConnection();
RealmModel realm = session.getContext().getRealm();

if (!session.getContext().getUri().getBaseUri().getScheme().equals("https") && realm.getSslRequired().isRequired(clientConnection)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public AbstractParEndpoint(KeycloakSession session, EventBuilder event) {
}

protected void checkSsl() {
ClientConnection clientConnection = session.getContext().getContextObject(ClientConnection.class);
ClientConnection clientConnection = session.getContext().getConnection();

if (!session.getContext().getUri().getBaseUri().getScheme().equals("https") && realm.getSslRequired().isRequired(clientConnection)) {
throw new CorsErrorResponseException(cors.allowAllOrigins(), OAuthErrorException.INVALID_REQUEST, "HTTPS required", Response.Status.FORBIDDEN);
Expand Down

0 comments on commit 2b0c91a

Please sign in to comment.