Reorganized files
This commit is contained in:
30
docs/api/authorization.md
Normal file
30
docs/api/authorization.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# HopFrame Authentication
|
||||
|
||||
With the provided HopFrame services, you can secure your endpoints so that only logged-in users or users with the right permissions can access the endpoint.
|
||||
|
||||
## Usage
|
||||
You can secure your endpoints by adding the `Authorized` attribute.
|
||||
|
||||
```csharp
|
||||
// Everyone can access this endpoint
|
||||
[HttpGet("hello")]
|
||||
public ActionResult<string> HelloWorld() {
|
||||
return "Hello, World!";
|
||||
}
|
||||
```
|
||||
|
||||
```csharp
|
||||
// Only logged-in users can access this endpoint
|
||||
[HttpGet("hello"), Authorized]
|
||||
public ActionResult<string> HelloWorld() {
|
||||
return "Hello, World!";
|
||||
}
|
||||
```
|
||||
|
||||
```csharp
|
||||
// Only logged-in users with the specified permissions can access this endpoint
|
||||
[HttpGet("hello"), Authorized("test.permission", "test.permission.another")]
|
||||
public ActionResult<string> HelloWorld() {
|
||||
return "Hello, World!";
|
||||
}
|
||||
```
|
||||
16
docs/api/installation.md
Normal file
16
docs/api/installation.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Ho to use the Web API version
|
||||
This Installation adds all HopFrame [endpoints](./endpoints.md) and [services](./services.md) to the application.
|
||||
|
||||
1. Add the HopFrame.Api library to your project:
|
||||
|
||||
```
|
||||
dotnet add package HopFrame.Api
|
||||
```
|
||||
|
||||
2. Create a [DbContext](../database.md) that inherits the ``HopDbContext`` and add a data source
|
||||
|
||||
3. Add the HopFrame services to your application, provide the previously created `DatabaseContext` that inherits from `HopDbContextBase`
|
||||
|
||||
```csharp
|
||||
builder.Services.AddHopFrame<DatabaseContext>();
|
||||
```
|
||||
Reference in New Issue
Block a user