Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OAuth docs #752

Merged
merged 3 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ How to release Turnilo in semi-automatic way using Github actions.
## [Custom Extensions](extending-turnilo.md)

How to customize Turnilo, plugins, query and request decorators.

## [OAuth integration](oauth.md)

How to integrate Turnilo with OAuth provider
37 changes: 37 additions & 0 deletions docs/oauth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# OAuth integration

* TOC
{:toc}

## Overview

Turnilo can integrate with your OAuth provider.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add information about supported integration method: PKCE?

Turnilo will:
* Redirect your users to authentication page,
* Handle authorization code flow with PKCE (Proof Key for Code Exchange )
* Will decorate all data requests with access token.

## Configuration

To enable OAuth support you need to add top level `oauth` option in your config with following fields:

- `clientId`: OAuth Client Identifier for your Turnilo instance
- `tokenEndpoint`: Full address of your [token endpoint](https://tools.ietf.org/html/rfc6749#section-3.2)
- `authorizationEndpoint`: Full address of your [authorization endpoint](https://tools.ietf.org/html/rfc6749#section-3.1)
- `redirectUri`: Full address of your Turnilo installation. If you go to this address in browser, your Turnilo install should launch and show home view.
- `tokenHeaderName`: Name of your choosing for the OAuth token header. You will be reading this header in your server plugin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have default for header name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No and I don't think we should. This name is used in admin's plugin and should be chosen deliberately.

I know that you like to have defaults for most of the config options but I think there's no good one here and we need to force admin to pick one.


Example:

```yaml
oauth:
clientId: "turnilo"
tokenEndpoint: "https://oauth.example.com/auth/oauth/token"
authorizationEndpoint: "https://oauth.example.com/auth/oauth/authorize"
tokenHeaderName: "x-turnilo-oauth-token"
redirectUri: "https://turnilo.example.com/"
```

## Further reading

Please refer to our [github discussion](https://github.com/allegro/turnilo/discussions/734) for our use case.