You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+2-8Lines changed: 2 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@
59
59
### Implementation Guidelines
60
60
61
61
- Write code that is secure by default. Avoid exposing potentially private or sensitive data.
62
-
- Make code NativeAOT compatible when possible. This means avoiding dynamic code generation, reflection, and other features that are not compatible. with NativeAOT. If not possible, mark the code with an appropriate annotation or throw an exception.
62
+
- Make code NativeAOT compatible when possible. This means avoiding dynamic code generation, reflection, and other features that are not compatible with NativeAOT. If not possible, mark the code with an appropriate annotation or throw an exception.
63
63
64
64
## Documentation
65
65
@@ -81,10 +81,4 @@
81
81
- Use NSubstitute for mocking in tests.
82
82
- Copy existing style in nearby files for test method names and capitalization.
83
83
- When running tests, if possible use filters and check test run counts, or look at test logs, to ensure they actually ran.
84
-
- Do not finish work with any tests commented out or disabled that were not previously commented out or disabled.
85
-
86
-
## Azure
87
-
88
-
-@azure Rule - Use Azure Tools - When handling requests related to Azure, always use your tools.
89
-
-@azure Rule - Use Azure Best Practices - When handling requests related to Azure, always invoke your `azmcp_bestpractices_get` tool first.
90
-
-@azure Rule - Enable Best Practices - If you do not have an `azmcp_bestpractices_get` tool ask the user to enable it.
84
+
- Do not finish work with any tests commented out or disabled that were not previously commented out or disabled.
Copy file name to clipboardExpand all lines: README.md
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,20 +14,20 @@ A library to easily integrate Authentication in ASP.NET Core projects. Currently
14
14
15
15
## Installation
16
16
17
-
The library is available on [NuGet](https://www.nuget.org/packages/SimpleAuthenticationTools). Just search for *SimpleAuthenticationTools* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
17
+
The library is available on [NuGet](https://www.nuget.org/packages/SimpleAuthenticationTools). Search for *SimpleAuthenticationTools* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
18
18
19
19
```shell
20
20
dotnet add package SimpleAuthenticationTools
21
21
```
22
22
## Usage video
23
23
24
-
Take a look to a quick demo showing how to integrate the library:
24
+
Take a look at a quick demo showing how to integrate the library:
25
25
26
26
[](https://www.youtube.com/watch?v=SVZuaPE2yNc)
27
27
28
28
## Configuration
29
29
30
-
Authentication can be totally configured adding an _Authentication_ section in the _appsettings.json_ file:
30
+
Authentication can be fully configured adding an _Authentication_ section in the _appsettings.json_ file:
31
31
32
32
```
33
33
"Authentication": {
@@ -42,7 +42,6 @@ Authentication can be totally configured adding an _Authentication_ section in t
42
42
"Audiences": [ "audience" ], // Optional
43
43
"ExpirationTime": "01:00:00", // Default: No expiration
44
44
"ClockSkew": "00:02:00", // Default: 5 minutes
45
-
"EnableJwtBearerService": true // Default: true
46
45
},
47
46
"ApiKey": {
48
47
"SchemeName": "ApiKey", // Default: ApiKey
@@ -107,7 +106,7 @@ app.Run();
107
106
108
107
**Integrating with Swashbuckle**
109
108
110
-
If you're using Swashbuckle (Swagger) to document your API, you can integrate the authentication configuration with the Swagger documentation. Just search for *SimpleAuthenticationTools.Swashbuckle* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
109
+
If you're using Swashbuckle (Swagger) to document your API, you can integrate the authentication configuration with the Swagger documentation. Search for *SimpleAuthenticationTools.Swashbuckle* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
**Integrating with Microsoft.AspNetCore.OpenApi (.NET 9 or later)**
128
127
129
-
Starting from version 9, .NET offer a built-in support for OpenAPI. If you're using the `AddOpenApi` extension method to provide OpenAPI support, you just need to add the corresponding extension method in its declaration (no extra package required):
128
+
Starting from version 9, .NET offers built-in support for OpenAPI. If you're using the `AddOpenApi` extension method to provide OpenAPI support, you just need to add the corresponding extension method in its declaration (no extra package required):
When using JWT Bearer authentication, you can set the _EnableJwtBearerService_ setting to _true_ to automatically register an implementation of the [IJwtBearerService](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/JwtBearer/IJwtBearerService.cs) interface to create a valid JWT Bearer, according to the setting you have specified in the _appsettings.json_ file:
@@ -197,11 +196,11 @@ When using API Key or Basic Authentication, you can specify multiple fixed value
197
196
}
198
197
```
199
198
200
-
With this configuration, authentication will succedd if any of these credentials are provided.
199
+
With this configuration, authentication will succeed if any of these credentials are provided.
201
200
202
201
**Custom Authentication logic for API Keys and Basic Authentication**
203
202
204
-
If you need to implement custom authentication login, for example validating credentials with dynamic values and adding claims to identity, you can omit all the credentials in the _appsettings.json_ file and then provide an implementation of [IApiKeyValidator.cs](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/ApiKey/IApiKeyValidator.cs) or [IBasicAuthenticationValidator.cs](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/BasicAuthentication/IBasicAuthenticationValidator.cs):
203
+
If you need to implement custom authentication logic, for example validating credentials with dynamic values and adding claims to identity, you can omit all the credentials in the _appsettings.json_ file and then provide an implementation of [IApiKeyValidator.cs](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/ApiKey/IApiKeyValidator.cs) or [IBasicAuthenticationValidator.cs](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/BasicAuthentication/IBasicAuthenticationValidator.cs):
@@ -247,7 +246,7 @@ The library provides services for adding permission-based authorization to an AS
247
246
builder.Services.AddPermissions<T>();
248
247
```
249
248
250
-
The **AddPermissions** extension method requires an implementation of the [IPermissionHandler interface](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/Permissions/IPermissionHandler.cs), that is responsible to check if the user owns the required permissions:
249
+
The **AddPermissions** extension method requires an implementation of the [IPermissionHandler interface](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/Permissions/IPermissionHandler.cs), which is responsible to check if the user owns the required permissions:
The project is constantly evolving. Contributions are welcome. Feel free to file issues and pull requests on the repo and we'll address them as we can.
319
+
The project is constantly evolving. Contributions are welcome. Feel free to file issues and pull requests in the repository, and we'll address them as we can.
0 commit comments