Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pool: http allow client to send credentials when TLS is used #5904

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ public HttpTransferService()
super("http");
}

CorsConfigBuilder corsConfigBuilder()
{
return CorsConfigBuilder.forAnyOrigin()
.allowNullOrigin()
.allowedRequestMethods(GET, PUT, HEAD)
.allowedRequestHeaders(CONTENT_TYPE, AUTHORIZATION, CONTENT_MD5,
"Want-Digest", "suppress-www-authenticate");
}

public int getChunkSize()
{
return chunkSize;
Expand Down Expand Up @@ -175,13 +184,7 @@ protected void addChannelHandlers(ChannelPipeline pipeline)
pipeline.addLast("custom-headers", new CustomResponseHeadersHandler(customHeaders));
}

CorsConfig corsConfig = CorsConfigBuilder.forAnyOrigin()
.allowNullOrigin()
.allowedRequestMethods(GET, PUT, HEAD)
.allowedRequestHeaders(CONTENT_TYPE, AUTHORIZATION, CONTENT_MD5,
"Want-Digest", "suppress-www-authenticate")
.build();
pipeline.addLast("cors", new CorsHandler(corsConfig));
pipeline.addLast("cors", new CorsHandler(corsConfigBuilder().build()));

pipeline.addLast("transfer", new HttpPoolRequestHandler(this, chunkSize));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import eu.emi.security.authn.x509.CrlCheckingMode;
import eu.emi.security.authn.x509.OCSPCheckingMode;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.cors.CorsConfigBuilder;
import io.netty.handler.ssl.SslHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -72,6 +73,12 @@ static String getHost(URI url)
: host;
}

@Override
CorsConfigBuilder corsConfigBuilder()
{
return super.corsConfigBuilder().allowCredentials();
}

@Override
protected URI getUri(HttpProtocolInfo protocolInfo, int port, UUID uuid)
throws SocketException, CacheException, URISyntaxException {
Expand Down