-
Notifications
You must be signed in to change notification settings - Fork 17
Replace IdentityServer4 with OpenIddict and upgrade to .net 9 #28
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
base: master
Are you sure you want to change the base?
Replace IdentityServer4 with OpenIddict and upgrade to .net 9 #28
Conversation
Upgrade nuget packages Fix npgsql errors from upgrade Note: (IpAddress, int) is now NpgsqlCidr
Migrate to nullable
This reverts commit 7b0520a.
Implement unit tests for multiple secret handling methods
Implement custom url validator
Work on admin oauth app settings page
Implement legacy token handling test
|
|
||
| var certificate = request.CreateSelfSigned(DateTimeOffset.UtcNow, DateTimeOffset.UtcNow.AddYears(10)); | ||
|
|
||
| File.WriteAllBytes("server-encryption-certificate.pfx", certificate.Export(X509ContentType.Pfx, string.Empty)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to add a check if any of these files exist and throw hard, so we don't accidentally the certs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this tool will be ran once I doubt it's really an issue. I guess it's quick though fo code just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowercase SQL is a crime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok well one thing you SHOULD actually do it update the dotnet version for the test so it wont fail
Also i guess look into net 10 support now, OpenIddict does support it
!!!This PR was locally tested extensively. It should still be tested with different oauth clients used in production though. Esp. the wiki as it can potentially break those oauth clients/application. Ideally upgrading SS14.Web is tested on a separate instance created from a snapshot first!!!
This PR updates the project to .net 9 and replaces IdentityServer4 with OpenIddict while trying to ensure that existing OAuth applications keep working. For that purpose there is a data migration sql script under
tools/identityserver4_to_openiddict_data_migration.sql.Differences between IdentityServer4 and OpenIddict
The biggest difference between the two OIDC solutions is the way client/applications are stored and the amount of extra features and settings.
OpenIddict uses a lot less database entities to store applications as it stores most non queried settings and configurations as json inside the application entity. It also doesn't normalize entities to quite the extent IS4 does.
This means there wasn't a need for a separate schema.
Also a lot of settings that weren't used got removed from the UI as implementing them with OpenIddict would mean adding custom settings and implementing custom event handlers (Which this PR already does for settings that had to be re-implemented like "PlainPkce" and "Allow PS256")
Encryption and Signing keys have to be supplied as certificates using PFX files.
OpenIddict also uses a different hashing algorithm for secrets and it salts them so migrated keys from IS4 are marked as legacy and handled seperatly using a re-implementation of the the way secrets are hashed in IS4 (Which uses standard .net cryptography methods).
Additional changes
Program.csandStartup.csforSS14.Web/SS14.Webinto a single top leverProgram.csfile.#nullable true.Noteworthy improvements
/.well-known/openid-configurationnow only lists actually supported capabilities and featuresuserinfoendpointGenerating encryption and signing certificates
At least one encryption and one signing certificate needs to be generated and configured for each encryption/signing algorithm that needs to be supported.
For this purpose a csx file exists under
tools\GenerateCerts.csx(I used the .net10 preview to execute it otherwise it needs a proper project file).Executing that file will generate 3 certificates. One encryption certificate using RS265 and two signing certificates using RS265 and PS265 respectively.
Example certificate configuration
Fixes #20
Fixes #17