From b0febcec10c39e7dec040259f7e92272c7b59e97 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 08:47:15 +0000 Subject: [PATCH] Update to Keycloak 25.0.2 --- src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java b/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java index e3223d1..ed6b635 100644 --- a/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java +++ b/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java @@ -1,13 +1,15 @@ package org.keycloak.protocol.cas.utils; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.keycloak.protocol.cas.representations.CASErrorCode; import org.keycloak.protocol.cas.representations.CASServiceResponse; import org.keycloak.protocol.cas.representations.CASServiceResponseAuthenticationFailure; import org.keycloak.protocol.cas.representations.CASServiceResponseAuthenticationSuccess; +import org.keycloak.protocol.cas.representations.CASServiceResponseProxySuccess; +import org.keycloak.protocol.cas.representations.CASServiceResponseProxyFailure; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import java.util.List; import java.util.Map; @@ -43,6 +45,24 @@ return response; } + public static CASServiceResponse createProxySuccess(String pt) { + CASServiceResponse response = new CASServiceResponse(); + CASServiceResponseProxySuccess success = new CASServiceResponseProxySuccess(); + success.setProxyTicket(pt); + response.setProxySuccess(success); + return response; + } + + public static CASServiceResponse createProxyFailure(CASErrorCode errorCode, String errorDescription) { + CASServiceResponse response = new CASServiceResponse(); + CASServiceResponseProxyFailure failure = new CASServiceResponseProxyFailure(); + failure.setCode(errorCode == null ? CASErrorCode.INTERNAL_ERROR.name() : errorCode.name()); + failure.setDescription(errorDescription); + response.setProxyFailure(failure); + + return response; + } + public static Response createResponse(Response.Status status, MediaType mediaType, CASServiceResponse serviceResponse) { Response.ResponseBuilder builder = Response.status(status) .header(HttpHeaders.CONTENT_TYPE, mediaType.withCharset("utf-8")); -- Gitblit v1.9.1