-
Notifications
You must be signed in to change notification settings - Fork 27
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
Update to .NET 9.0 #132
Merged
Merged
Update to .NET 9.0 #132
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Updated README.md to note Swashbuckle support moved to SimpleAuthentication.Swashbuckle. - Added SimpleAuthentication.Swashbuckle project to solution. - Updated sample projects to target net9.0 and reference SimpleAuthentication.Swashbuckle. - Updated SimpleAuthentication.csproj with conditional OpenApi reference and updated dependencies. - Removed Swashbuckle-related files from SimpleAuthentication. - Added GitHub Actions workflow to publish SimpleAuthentication.Swashbuckle to NuGet. - Added SimpleAuthentication.Swashbuckle project and documentation files. - Introduced new functionality for authentication support in Swagger, including JWT Bearer, API Key, and Basic Authentication schemes. - Added version.json for version management with NerdBank.GitVersioning.
Introduce new functionality for adding authentication support in Swagger for .NET 9.0 or greater. This includes configuring and displaying the Authorize button in the Swagger UI for JWT Bearer, API Key, and Basic Authentication. Encapsulate changes within `#if NET9_0_OR_GREATER` preprocessor directives to ensure compatibility with .NET 9.0+. Add new using directives for necessary namespaces. Introduce `SwaggerExtensions` class in `OpenApiExtensions.cs` with `AddSimpleAuthentication` methods for configuring Swagger authentication. Add `AuthenticationDocumentTransformer` class in `AuthenticationDocumentTransformer.cs` to transform OpenAPI documents with security definitions and requirements. Add `AuthenticationOperationTransformer` class in `AuthenticationOperationTransformer.cs` to automatically add 401 and 403 responses to authorized operations. Introduce `Helpers` class in `Helpers.cs` with utility methods for creating security requirements and responses. Ensure Swagger UI supports various authentication schemes for easier testing of authenticated endpoints.
Updated SimpleAuthentication.sln to include Net8JwtBearerSample. Replaced Swashbuckle with OpenAPI in JwtBearerSample.csproj. Refactored Program.cs for OpenAPI configuration. Simplified OpenApiSecurityRequirement and OpenApiResponse in Helpers.cs. Renamed SwaggerExtensions to OpenApiExtensions in OpenApiExtensions.cs. Added appsettings.Development.json and appsettings.json for config. Added Net8JwtBearerSample.csproj with necessary dependencies. Added Program.cs for Net8JwtBearerSample setup. Added ApplicationAuthenticationSchemeProvider.cs for custom auth logic. Added ClaimsTransformer.cs for custom claims transformation. Added launchSettings.json for JwtBearerSample project.
Updated README.md: - Reformatted installation, configuration, and code examples using code blocks. - Added sections for Swashbuckle and Microsoft.AspNetCore.OpenApi integration. - Documented a known issue with `AddSimpleAuthentication` and `AddOpenApi`. - Updated JWT Bearer and custom authentication logic examples. - Enhanced permission-based authorization section. - Added links to JWT Bearer and API Key samples. Cleaned up AuthenticationOperationTransformer.cs: - Removed several unused `using` directives.
Refactored and added new functionality for OpenAPI and Swagger integration related to authentication in a .NET project. Removed `Helpers` class and moved its functionality to a new `OpenApiHelpers` class. Updated `AuthenticationOperationFilter` and `AuthenticationOperationTransformer` to use `OpenApiHelpers`. Updated `SwaggerExtensions` and `OpenApiExtensions` to support OAuth2 authentication, including new methods for adding OAuth2 schemes and security requirements. Introduced `OAuth2AuthenticationDocumentTransformer` for transforming OpenAPI documents to include OAuth2. Ensured compatibility with .NET 9.0+ using conditional compilation. Defined `OpenApiHelpers` in both `SimpleAuthentication.Swagger` and `SimpleAuthentication.OpenApi` namespaces for different contexts. #127 #128
Updated documentation comments to standardize "OpenAPI" terminology and clarify "OAuth2 custom authentication support." Corrected minor grammatical errors for improved readability. No functional code changes. #128
Updated Nerdbank.GitVersioning package from 3.6.146 to 3.7.112 in Directory.Build.props. Incremented project version in version.json from 2.1 to 3.0, indicating a new release or significant update. #127
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several significant changes, primarily focusing on the integration of Swashbuckle for Simple Authentication, updates to the README documentation, and project configuration adjustments. The key changes are grouped by their themes below:
Workflow and Project Configuration:
.github/workflows/publish_swashbuckle.yml
).SimpleAuthentication.Swashbuckle
project. [1] [2] [3] [4]SimpleAuthentication.Swashbuckle
project in the solution file (SimpleAuthentication.sln
). [1] [2] [3]Documentation Updates:
Codebase Adjustments:
Program.cs
file in theJwtBearerSample
to useAddOpenApi
instead ofAddSwaggerGen
for OpenAPI configuration.Closes #127
Closes #128