Skip to content

Commit

Permalink
Auth docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Mar 6, 2019
1 parent 2c96787 commit 8d549ce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
16 changes: 16 additions & 0 deletions doc/endpoint/auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Authentication

Inputs which carry authentication data wrap another input can be marked as such by declaring them using members of the
`auth` object. Apart from predefined codecs for some authentication methods, such inputs will be treated differently]
when generating documentation. Otherwise, they behave as normal inputs which map to the the given type.

Currently, the following authentication inputs are available (assuming `import tapir._`):

* `auth.apiKey(anotherInput)`: wraps any other input and designates it as an api key. The input is typically a header
or a query parameter
* `auth.basic: EndpointInput[UsernamePassword]`: maps to the base64-encoded username/password pair in the
`Authorization` header
* `auth.bearer: EndpointInput[String]`: maps to `Bearer [token]` in the `Authorization` header

Multiple authentication inputs indicate that all of the given authentication values should be provided. Specifying
alternative authentication methods (where only one value out of many needs to be provided) is currently not supported.
6 changes: 5 additions & 1 deletion doc/endpoint/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ For example:
case class RegistrationForm(userData: User, photo: Part[File], news: Boolean)

multipartBody[RegistrationForm]
```
```

## Next

Read on about [authentication](auth.html).
1 change: 1 addition & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ which is a slight extension of the above.
* [Endpoints: codecs](endpoint/codecs.md)
* [Endpoints: working with JSON](endpoint/json.md)
* [Endpoints: forms](endpoint/forms.md)
* [Endpoints: authentication](endpoint/auth.md)
* [Servers: akka-http interpreter](server/akkahttp.md)
* [Servers: http4s interpreter](server/http4s.md)
* [Servers: common configuration](server/common.md)
Expand Down

0 comments on commit 8d549ce

Please sign in to comment.