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 16:55:59 +0000 Subject: [PATCH] Update to Keycloak 21.0.0 --- src/main/java/org/keycloak/protocol/cas/CASLoginProtocolService.java | 11 +++++------ src/main/java/org/keycloak/protocol/cas/CASLoginProtocolFactory.java | 4 ++-- pom.xml | 4 ++-- src/main/java/org/keycloak/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 @@ <groupId>org.keycloak</groupId> <artifactId>keycloak-protocol-cas</artifactId> - <version>20.0.5</version> + <version>21.0.0</version> <name>Keycloak CAS Protocol</name> <description /> @@ -36,7 +36,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> - <project.build.outputTimestamp>1676969243</project.build.outputTimestamp> + <project.build.outputTimestamp>1677228457</project.build.outputTimestamp> </properties> <dependencies> 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 @@ } @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,11 +12,9 @@ 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; @@ -24,8 +22,9 @@ @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 @@ @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 @@ 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 @@ updateAuthenticationSession(); // So back button doesn't work - CacheControlUtil.noBackButtonCacheControlHeader(); + CacheControlUtil.noBackButtonCacheControlHeader(session); if (renew) { authenticationSession.setClientNote(CASLoginProtocol.RENEW_PARAM, "true"); -- Gitblit v1.9.1