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

requestClientCertificate: true when calling [HttpServer.bindSecure()`] #389

Open
nathan2day opened this issue Oct 14, 2023 · 2 comments
Open

Comments

@nathan2day
Copy link

I need to use dart shelf with mutual ssl auth, please could we expose requestClientCertificate ?

Future serve(
Handler handler,
Object address,
int port, {
SecurityContext? securityContext,
int? backlog,
bool requestClientCertificate = false,
bool shared = false,
String? poweredByHeader = 'Dart with package:shelf',
}) async {
backlog ??= 0;
var server = await (securityContext == null
? HttpServer.bind(address, port, backlog: backlog, shared: shared)
: HttpServer.bindSecure(
address,
port,
securityContext,
backlog: backlog,
requestClientCertificate: requestClientCertificate,
shared: shared,
));
serveRequests(server, handler, poweredByHeader: poweredByHeader);
return server;
}

Ah, I see. Just using SSL isn't enough to set HttpRequest.certificate; it's a client-side certificate, which means the server has to request it (by setting requestClientCertificate: true when calling HttpServer.bindSecure()) and the client has to send it (by passing a security context to HttpClient(), which you're doing). We don't currently expose requestClientCertificate in shelf_io.serve... you could add that if you want, but I don't think anyone really uses client certificates so I'd be fine limiting this pull request to exposing the connection info.

Originally posted by @nex3 in #92 (comment)

@kevmoo
Copy link
Member

kevmoo commented Oct 16, 2023

This this a request for shelf or for dart:io?

@kevmoo kevmoo added the needs-info Additional information needed from the issue author label Oct 16, 2023
@nathan2day
Copy link
Author

Shelf as dart.io already has the ability to request a client certificate for mutual auth but it's missing from shelf unfortunately

@github-actions github-actions bot removed the needs-info Additional information needed from the issue author label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants