Skip to content

Commit 1a5e0ae

Browse files
Copilotmarcominerva
andcommitted
Merge branch 'develop' to resolve conflicts
Co-authored-by: marcominerva <3522534+marcominerva@users.noreply.github.com>
1 parent 3e14dd7 commit 1a5e0ae

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ A library to easily integrate Authentication in ASP.NET Core projects. Currently
1414
1515
## Installation
1616

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**:
1818

1919
```shell
2020
dotnet add package SimpleAuthenticationTools
2121
```
2222
## Usage video
2323

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:
2525

2626
[![Simple Authentication for ASP.NET Core](https://raw.githubusercontent.com/marcominerva/SimpleAuthentication/master/Screenshot.jpg)](https://www.youtube.com/watch?v=SVZuaPE2yNc)
2727

2828
## Configuration
2929

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:
3131

3232
```
3333
"Authentication": {
@@ -106,7 +106,7 @@ app.Run();
106106

107107
**Integrating with Swashbuckle**
108108

109-
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**:
110110

111111
```shell
112112
dotnet add package SimpleAuthenticationTools.Swashbuckle
@@ -125,7 +125,7 @@ builder.Services.AddSwaggerGen(options =>
125125

126126
**Integrating with Microsoft.AspNetCore.OpenApi (.NET 9 or later)**
127127

128-
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):
129129

130130
```csharp
131131
builder.Services.AddOpenApi(options =>
@@ -141,7 +141,7 @@ builder.Services.AddOpenApi(options =>
141141
When using JWT Bearer authentication, an implementation of the [IJwtBearerService](https://github.com/marcominerva/SimpleAuthentication/blob/master/src/SimpleAuthentication.Abstractions/JwtBearer/IJwtBearerService.cs) interface is automatically registered to create a valid JWT Bearer, according to the settings you have specified in the _appsettings.json_ file:
142142

143143
```csharp
144-
app.MapPost("api/auth/login", (LoginRequest loginRequest, IJwtBearerService jwtBearerService) =>
144+
app.MapPost("api/auth/login", async (LoginRequest loginRequest, IJwtBearerService jwtBearerService) =>
145145
{
146146
// Check for login rights...
147147
@@ -152,7 +152,7 @@ app.MapPost("api/auth/login", (LoginRequest loginRequest, IJwtBearerService jwtB
152152
new(ClaimTypes.Surname, "Minerva")
153153
};
154154

155-
var token = jwtBearerService.CreateToken(loginRequest.UserName, claims);
155+
var token = await jwtBearerService.CreateTokenAsync(loginRequest.UserName, claims);
156156
return TypedResults.Ok(new LoginResponse(token));
157157
});
158158

@@ -196,11 +196,11 @@ When using API Key or Basic Authentication, you can specify multiple fixed value
196196
}
197197
```
198198

199-
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.
200200

201201
**Custom Authentication logic for API Keys and Basic Authentication**
202202

203-
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):
204204

205205
```csharp
206206
builder.Services.AddTransient<IApiKeyValidator, CustomApiKeyValidator>();
@@ -246,7 +246,7 @@ The library provides services for adding permission-based authorization to an AS
246246
builder.Services.AddPermissions<T>();
247247
```
248248

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), 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:
250250

251251
```csharp
252252
public interface IPermissionHandler
@@ -316,4 +316,4 @@ app.MapGet("api/me", (ClaimsPrincipal user) =>
316316

317317
## Contribute
318318

319-
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 on the repository, and we'll address them as we can.

0 commit comments

Comments
 (0)