feat: support partial authentication (#372) (#375)

This commit is contained in:
Geir Sagberg
2022-11-08 20:59:35 +01:00
committed by GitHub
parent 2c1c8fbcdc
commit 01b6b59cf5
20 changed files with 1172 additions and 806 deletions

View File

@ -183,3 +183,24 @@ get = GetInfo.builder {
}
}
```
## Partial Authentication
One might want to have a public GET endpoint but a protected PUT endpoint. This can be achieved by registering two
separate notarized routes. Note that you will get an error if you try to register the same method twice, as each path
can only have one registration per method. Example:
```kotlin
route("/user/{id}") {
get = GetInfo.builder {
// ...
}
// ...
authenticate {
put = PutInfo.builder {
// ...
}
// ...
}
}
```