From 7a0ad6ff21c508524fb562b97405480547259c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Muzik=C3=A1=C5=99?= Date: Fri, 2 Dec 2022 10:46:36 +0100 Subject: [PATCH] Handle `null` in HttpRequestImpl --- .../keycloak/services/HttpRequestImpl.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/services/src/main/java/org/keycloak/services/HttpRequestImpl.java b/services/src/main/java/org/keycloak/services/HttpRequestImpl.java index 80a57d9e2f..231568c93e 100644 --- a/services/src/main/java/org/keycloak/services/HttpRequestImpl.java +++ b/services/src/main/java/org/keycloak/services/HttpRequestImpl.java @@ -17,42 +17,58 @@ package org.keycloak.services; -import java.security.cert.X509Certificate; +import org.keycloak.http.HttpRequest; + import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; -import org.keycloak.http.HttpRequest; +import java.security.cert.X509Certificate; public class HttpRequestImpl implements HttpRequest { private org.jboss.resteasy.spi.HttpRequest delegate; - public HttpRequestImpl(org.jboss.resteasy.spi.HttpRequest delegate) { + public HttpRequestImpl(org.jboss.resteasy.spi.HttpRequest delegate) { this.delegate = delegate; } @Override public String getHttpMethod() { + if (delegate == null) { + return null; + } return delegate.getHttpMethod(); } @Override public MultivaluedMap getDecodedFormParameters() { + if (delegate == null) { + return null; + } return delegate.getDecodedFormParameters(); } @Override public HttpHeaders getHttpHeaders() { + if (delegate == null) { + return null; + } return delegate.getHttpHeaders(); } @Override public X509Certificate[] getClientCertificateChain() { + if (delegate == null) { + return null; + } return (X509Certificate[]) delegate.getAttribute("javax.servlet.request.X509Certificate"); } @Override public UriInfo getUri() { + if (delegate == null) { + return null; + } return delegate.getUri(); } }