New OpenID and OAuth2 drivers (#8660)

* Moved over oauth impl to new interface

* Fixed most build issues and started addind schema to auth drivers

* Finished up OAuth2 and OpenID drivers

* Removed unused migration and utils

* Fixed minor todos

* Removed old oauth flow

* Changed oauth flow to re-use refresh token

* Added new oauth frontend

* Added font awesome social icons

* Updated authentication documentation

* Update api/src/auth/drivers/oauth2.ts

* Tested implementation and fixed incorrect validation

* Updated docs

* Improved OAuth error handling and re-enabled creating users with provider/identifier

* Removed Session config from docs

* Update app/src/components/v-icon/v-icon.vue

* Removed oauth need to define default roleID

* Added FormatTitle to SSO links

* Prevent local auth without password

* Store OAuth access token in session data

* Update docs/guides/api-config.md

* Fixed copy and removed fontawesome-vue dependency

* More docs fixes

* Crucialy importend type fiks

* Update package-lock

* Remove is-email-allowed check

In favor of more advanced version based on filtering coming later

* Fix JSON type casting

* Delete unused util

* Update type signature to include name

* Add warning when code isn't found in oauth url

and remove obsolete imports

* Auto-continue on successful SSO login

* Tweak type signature

* More type casting shenanigans

* Please the TS gods

* Check for missing token before crashing

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
Aiden Foxx
2021-10-21 23:45:01 +02:00
committed by GitHub
parent 1b64b4472a
commit fa3b1171e8
36 changed files with 1747 additions and 822 deletions

View File

@@ -80,6 +80,10 @@ The token's expiration time can be configured through
POST /auth/login
```
```
POST /auth/login/:provider
```
```json
{
"email": "admin@example.com",
@@ -331,17 +335,16 @@ mutation {
---
## List oAuth providers
## List Auth Providers
List all the configured oAuth providers.
List all the configured auth providers.
<div class="two-up">
<div class="left">
::: tip Configuring oAuth
::: tip Configuring auth providers
To learn more about setting up oAuth providers, see
[Configuring SSO through oAuth](/guides/api-config/#oauth-single-sign-on-sso-openid).
To learn more about setting up auth providers, see [Configuring auth providers](/guides/api-config/#auth).
:::
@@ -350,7 +353,7 @@ To learn more about setting up oAuth providers, see
<div class="definitions">
`data` **Array**\
Array of configured oAuth providers.
Array of configured auth providers.
</div>
@@ -358,12 +361,27 @@ Array of configured oAuth providers.
<div class="right">
```
GET /auth/oauth
GET /auth
```
```json
{
"data": ["GitHub", "Google", "Okta"]
"data": [
{
"name": "GitHub",
"driver": "oauth2",
"icon": "github"
},
{
"name": "Google",
"driver": "openid",
"icon": "google"
},
{
"name": "Okta",
"driver": "openid"
}
]
}
```
@@ -372,15 +390,15 @@ GET /auth/oauth
---
## Login using oAuth provider
## Login Using SSO Providers
Will redirect to the configured oAuth provider for the user to login.
Will redirect to the configured SSO provider for the user to login.
<div class="two-up">
<div class="right">
```
GET /auth/oauth/:provider
GET /auth/login/:provider
```
</div>