KEYCLOAK-8008 Ensure InputStream are closed
This commit is contained in:
parent
e1ecf94428
commit
4b9b189016
2 changed files with 8 additions and 6 deletions
|
@ -68,11 +68,12 @@ public class AuthorizationEndpointRequestParserProcessor {
|
||||||
if (requestParam != null) {
|
if (requestParam != null) {
|
||||||
new AuthzEndpointRequestObjectParser(session, requestParam, client).parseRequest(request);
|
new AuthzEndpointRequestObjectParser(session, requestParam, client).parseRequest(request);
|
||||||
} else if (requestUriParam != null) {
|
} else if (requestUriParam != null) {
|
||||||
InputStream is = session.getProvider(HttpClientProvider.class).get(requestUriParam);
|
try (InputStream is = session.getProvider(HttpClientProvider.class).get(requestUriParam)) {
|
||||||
String retrievedRequest = StreamUtil.readString(is);
|
String retrievedRequest = StreamUtil.readString(is);
|
||||||
|
|
||||||
new AuthzEndpointRequestObjectParser(session, retrievedRequest, client).parseRequest(request);
|
new AuthzEndpointRequestObjectParser(session, retrievedRequest, client).parseRequest(request);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,9 @@ import java.security.PublicKey;
|
||||||
public class JWKSHttpUtils {
|
public class JWKSHttpUtils {
|
||||||
|
|
||||||
public static JSONWebKeySet sendJwksRequest(KeycloakSession session, String jwksURI) throws IOException {
|
public static JSONWebKeySet sendJwksRequest(KeycloakSession session, String jwksURI) throws IOException {
|
||||||
InputStream is = session.getProvider(HttpClientProvider.class).get(jwksURI);
|
try (InputStream is = session.getProvider(HttpClientProvider.class).get(jwksURI)){
|
||||||
String keySetString = StreamUtil.readString(is);
|
String keySetString = StreamUtil.readString(is);
|
||||||
return JsonSerialization.readValue(keySetString, JSONWebKeySet.class);
|
return JsonSerialization.readValue(keySetString, JSONWebKeySet.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue