flakey-bit / DotNetDigestAuth

Implementation of Digest Authentication for ASP.NET Core & ASP.NET
MIT License
17 stars 6 forks source link

.NET 5 support #10

Closed rolfik closed 3 years ago

rolfik commented 3 years ago

Dear @flakey-bit, I have used Your project in our ASP.NET Core 5 application and updated it to .NET 5 in my fork. I use it in combination with cookie authentication which allows me to do login/logout as well, but that integration is part of our another library we use internally.

Thank You for Your work.

Marek Ištvánek

flakey-bit commented 3 years ago

Hi @rolfik,

Can you tell me more about your change-set? Did you have problems using the library in a project targeting net5.0? Anyway, I've tested it just now (in master) and the library works as-is in a project targeting net5.0 (i.e. no changes were needed).

That said, if you take a look at https://github.com/flakey-bit/DotNetDigestAuth/commit/096e714e4bb71ab3e9e916879bd84140b2358047 you'll see I've updated the sample project and integration tests to target net5.0.

Please let me know if you think something further needs to be done to support net5.0, otherwise I'll close this issue.

rolfik commented 3 years ago

I have made only small changes: https://github.com/HaSaM-cz/DotNetDigestAuth/commit/a22ef98c046c9879839eae2d387cdc9c8faa745a Most important is ClaimsIdentity construction fix.

I use it with cookie authentication middleware and custom controller providing sing in and out. To do it I had to use short nonce time about 5 s. If anybody is interested, I can share the code.

flakey-bit commented 3 years ago

Hi @rolfik,

The title of the issue you've opened ".NET 5 support" tends to imply the library doesn't work with that framework, which I think is incorrect so I'll probably close this issue.

The parameters passed to construction of the ClaimsIdentity indeed look to be incorrect (as you've identified). I'll fix that shortly.

I see you your PR also adds support for changing the scheme name. I'm curious to know what your use case was for wanting to do that. Have you looked into policy schemes https://docs.microsoft.com/en-us/aspnet/core/security/authentication/policyschemes?view=aspnetcore-5.0 as potentially this will be a more elegant solution for your problem (combining cookie authentication with another scheme).

That said, I'll add support for customising the scheme name soon.

rolfik commented 3 years ago

@flakey-bit without changing the ClaimsIdentity construction I could not make it work with cookie authentication. The ability of changing scheme name was just how other ASP.NET Core extensions for adding authentications are done. I actually do not use it anyway, but use the introduced "Digest" constant in custom controller authorizing with Digest scheme for sign in with cookies.

flakey-bit commented 3 years ago

@rolfik please take a look at the latest build on NuGet and see if you can use it.

Cheers, Eddie