-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Optional client certificates sample #21484
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
Conversation
Provide a certificate that allows 127.0.0.1 CAB forum won't allow IP addresses in public certificates any more, so it'd be slightly unrealistic to have the cert tool create one. |
That's just for the sample anyways. It has no bearing on the real scenario. |
Thanks @Tratcher. I am trying to implement your suggestion, but when create subdomain, I have a doubt: |
This approach requires all or nothing unless you split them into two completely different apps. You can still redirect back to the root site afterwards. |
I ended up using sub-domains - like identityserver.io and mtls.identityserver.io. I used nginx to provide the two entry points and then route to the same application. https://identityserver4.readthedocs.io/en/latest/topics/mtls.html#identityserver-setup |
I need to have a closer look at your approach. But a bit busy right now. |
@leastprivilege thanks, that maps to what I'm proposing here. How do you handle switching between them? E.g. Challenging for cert auth? Would a Challenge event on the cert auth handler help? |
Not sure what you mean with "switch" - but we do this |
That middleware looks designed to only attempt cert auth if the request matched a certain domain or path. What do you do if you're on the non-mtls domain and someone wants to log in with client certs? You redirect them to the mtls domain, correct? How do you manage that flow? |
Ah I see - we are only doing client authentication with certs - IOW the client knows upfront. |
bbefbcf
to
3ac1314
Compare
src/Security/Authentication/Certificate/samples/Certificate.Optional.Sample/Program.cs
Outdated
Show resolved
Hide resolved
src/Security/Authentication/Certificate/samples/Certificate.Optional.Sample/Program.cs
Outdated
Show resolved
Hide resolved
src/Security/Authentication/Certificate/samples/Certificate.Optional.Sample/Startup.cs
Outdated
Show resolved
Hide resolved
Hello @Tratcher! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@Tratcher I am looking to use your sample to integrate Azure API Manager (APIM) with an on prem Service Fabric cluster at one of my clients. What would it take to use host names in your Sample instead of IP's? I am having a hard time find a solution that would leverage this technique instead. Would I need to go the route that @lukewaters went in creating some Middleware to check the pipeline? |
Hi @conkman. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
@blowdart @HaoK @anurse
We've had several requests around how to set up an application where client certificates were only required for some paths (#21193 @leastprivilege @brockallen @FDonald). There are lots of protocol issues with that (see the readme.md), so I came up with a proposal based on host names. This is the first sample I've put together that implements that proposal.
In this first draft I proved it can work, but rough and has exposed a few holes in our infrastructure.
Unrelated: I've cherry picked #21467 to work around a Kestrel regression.
Do we think this is worth expanding on? Should I file issues for the gaps like adding a Challenge event?