hanicz commented on code in PR #1459: URL: https://github.com/apache/knox/pull/1459#discussion_r4323851396
########## gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/SetHostSSLSocketFactory.java: ########## @@ -0,0 +1,175 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.knox.gateway.services.token.impl; Review Comment: There is already a Fips related package in gateway-spi `org.apache.knox.gateway.fips` ########## gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenAuthorityService.java: ########## @@ -377,17 +380,26 @@ private JWKSource<SecurityContext> buildJwkSource(URL jwksUrl, ResourceRetriever final long outageTTL = config.getJwksOutageCacheTTL(); final long cacheTTL = config.getJwksCacheTimeToLive(); final long cacheTimeOut = config.getJwksCacheRefreshTimeout(); - final JWKSourceBuilder<SecurityContext> builder = retriever == null - ? JWKSourceBuilder.create(jwksUrl) - : JWKSourceBuilder.create(jwksUrl, retriever); - return builder + final ResourceRetriever jwksRetriever = retriever == null ? defaultResourceRetriever(jwksUrl) : retriever; + return JWKSourceBuilder.<SecurityContext>create(jwksUrl, jwksRetriever) .cache(cacheTTL, cacheTimeOut) .refreshAheadCache(true) .retrying(true) .outageTolerant(outageTTL) .build(); } + /* + * The retriever Nimbus would build for a URL, except that its sockets carry the JWKS host so + * HTTPS endpoint identification can run under the BouncyCastle FIPS provider. See + * SetHostSSLSocketFactory. Timeouts and size limit match the Nimbus defaults. + */ + private static ResourceRetriever defaultResourceRetriever(URL jwksUrl) { Review Comment: We should gate this on FIPS. We already have the FipsUtils class that identifies FIPS environments. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
