From 58cce9e3b5ed19e26c3748b66536c160a266e885 Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Fri, 24 Feb 2023 08:47:40 +0000
Subject: [PATCH] Update to Keycloak 21.0.0
---
pom.xml | 4 ++--
.../protocol/cas/CASLoginProtocolFactory.java | 4 ++--
.../protocol/cas/CASLoginProtocolService.java | 11 +++++------
.../protocol/cas/endpoints/AuthorizationEndpoint.java | 8 ++++----
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/pom.xml b/pom.xml
index bbfc4bb..f520ef0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.keycloak
keycloak-protocol-cas
- 20.0.5
+ 21.0.0
Keycloak CAS Protocol
@@ -36,7 +36,7 @@
UTF-8
1.8
1.8
- 1676969243
+ 1677228457
diff --git a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolFactory.java b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolFactory.java
index 2702466..fb7a7b5 100644
--- a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolFactory.java
+++ b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolFactory.java
@@ -86,8 +86,8 @@ protected void addDefaults(ClientModel client) {
}
@Override
- public Object createProtocolEndpoint(RealmModel realm, EventBuilder event) {
- return new CASLoginProtocolService(realm, event);
+ public Object createProtocolEndpoint(KeycloakSession session, EventBuilder event) {
+ return new CASLoginProtocolService(session, event);
}
@Override
diff --git a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolService.java b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolService.java
index 2448808..041303e 100644
--- a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolService.java
+++ b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocolService.java
@@ -12,20 +12,19 @@
import javax.ws.rs.core.*;
public class CASLoginProtocolService {
+ private KeycloakSession session;
private RealmModel realm;
private EventBuilder event;
- @Context
- private KeycloakSession session;
-
@Context
private HttpHeaders headers;
@Context
private HttpRequest request;
- public CASLoginProtocolService(RealmModel realm, EventBuilder event) {
- this.realm = realm;
+ public CASLoginProtocolService(KeycloakSession session, EventBuilder event) {
+ this.session = session;
+ this.realm = session.getContext().getRealm();
this.event = event;
}
@@ -35,7 +34,7 @@ public static UriBuilder serviceBaseUrl(UriBuilder baseUriBuilder) {
@Path("login")
public Object login() {
- AuthorizationEndpoint endpoint = new AuthorizationEndpoint(realm, event);
+ AuthorizationEndpoint endpoint = new AuthorizationEndpoint(session, event);
ResteasyProviderFactory.getInstance().injectProperties(endpoint);
return endpoint;
}
diff --git a/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java b/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
index 90c34ae..103249f 100644
--- a/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
+++ b/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
@@ -6,7 +6,7 @@
import org.keycloak.events.EventBuilder;
import org.keycloak.events.EventType;
import org.keycloak.models.ClientModel;
-import org.keycloak.models.RealmModel;
+import org.keycloak.models.KeycloakSession;
import org.keycloak.protocol.AuthorizationEndpointBase;
import org.keycloak.protocol.cas.CASLoginProtocol;
import org.keycloak.protocol.oidc.utils.RedirectUtils;
@@ -26,8 +26,8 @@ public class AuthorizationEndpoint extends AuthorizationEndpointBase {
private AuthenticationSessionModel authenticationSession;
private String redirectUri;
- public AuthorizationEndpoint(RealmModel realm, EventBuilder event) {
- super(realm, event);
+ public AuthorizationEndpoint(KeycloakSession session, EventBuilder event) {
+ super(session, event);
event.event(EventType.LOGIN);
}
@@ -53,7 +53,7 @@ public Response build() {
updateAuthenticationSession();
// So back button doesn't work
- CacheControlUtil.noBackButtonCacheControlHeader();
+ CacheControlUtil.noBackButtonCacheControlHeader(session);
if (renew) {
authenticationSession.setClientNote(CASLoginProtocol.RENEW_PARAM, "true");