Commit Graph

40 Commits

Author SHA1 Message Date
Aiden Foxx
28d60131a3 Handle not unique errors during auto-registration (#14625)
* Handle RecordNotUniqueException in oauth

* Handle RecordNotUniqueException in openid

* Added RecordNotUniqueException handling for ldap

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

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

* Add LDAP unique user log

* Added unique user log to oauth

* Added unique user log to OpenID

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

* Update api/src/auth/drivers/oauth2.ts
2022-07-25 14:09:51 -04:00
Aiden Foxx
c3a19c44cb Terminate Directus if OpenID discovery fails (#14287) 2022-07-07 11:19:50 +02:00
Rijk van Zanten
32dd709778 Insights 2.0 (#14096)
* query function added to list

* dashboard reading query, adding to object

* typecasting of filter vals needed still

* numbers accepting strings too

* json-to-graphql-query => devD

* fixed unneeded return in list index.ts

* stitching and calling but not actually calling

* calls on panel change

* query object += new panel before dashboard save

* uuid generated in app not api

* fixed panel ids in query

* fixed the tests I just wrote

* passing the query data down!

* list showing data

* objDiff test moved to test

* metric bug fixes + data

* dashboard logic

* time series conversion started

* timeseries GQL query almost there

* query querying

* chart loading

* aggregate handling improved

* error handling for aggregate+filter errors

* removed query on empty queryObj

* maybe more error handling

* more error handling working

* improvements to erorr handling

* stitchGQL() error return type corrected

* added string fields to COUNT

* pushing up but needs work

* not an endless recursion

* its not pretty but it works.

* throws an error

* system collections supported

* refactor to solve some errors

* loading correct

* metric function fixed

* data loading but not blocking rendering

* removed redundant code.

* relational fields

* deep nesting relations

* options.precision has a default

* relational fields fix. (thanks azri)

* the limit

* limit and time series

* range has a default

* datat to workspace

* v-if

* panels loading

* workspaces dont get data anymore

* package.json

* requested changes

* loading

* get groups util

* timeseries => script setup

* list => script setup

* metric => script setup

* label => script setup

* declare optional props

* loadingPanels: only loading spinner on loading panels

* remove unneeded parseDate!!

* applyDataToPanels tests

* -.only

* remove unneeded steps

* processQuery tests

* tests

* removed unused var

* jest.config and some queryCaller tests

* one more test

* query tests

* typo

* clean up

* fix some but not all bugs

* bugs from merge fixed

* Start cleaning up 🧹

* Refactor custom input type

* Small tweaks in list index

* Cleanup imports

* Require Query object to be returned from query prop

* Tweak return statement

* Fix imports

* Cleanup metric watch effect

* Tweaks tweaks tweaks

* Don't rely on options, simplify fetch logic

* Add paths to validation errors

* [WIP] Start handling things in the store

* Rework query fetching logic into store

* Clean up data passing

* Use composition setup for insights store

* Remove outdated

* Fix missing return

* Allow batch updating in REST API

Allows sending an array of partial items to the endpoints, updating all to their own values

* Add batch update to graphql

* Start integrating edits

* Readd clear

* Add deletion

* Add duplication

* Finish create flow

* Resolve cache refresh on panel config

* Prevent warnings about component name

* Improve loading state

* Finalize dashboard overhaul

* Add auto-refresh sidebar detail

* Add efficient panel reloading

* Set/remove errors on succeeded requests

* Move options rendering to shared

* Fix wrong imports, render options in app

* Selectively reload panels with changed variables

* Ensure newly added panels don't lose data

* Only refresh panel if data query changed

* Never use empty filter object in metric query

* Add default value support to variable panel

* Centralize no-data state

* Only reload data on var change when query is altered

* Fix build

* Fix time series order

* Remove unused utils

* Remove no-longer-used logic

* Mark batch update result as non-nullable in GraphQL schema

* Interim flows fix

* Skip parsing undefined keys

* Refresh insights dashboard when discarding changes

* Don't submit primary key when updating batch

* Handle null prop field better

* Tweak panel padding

Co-authored-by: jaycammarano <jay.cammarano@gmail.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
2022-06-27 15:26:42 -04:00
José Varela
4a75a2bcbc Return more error messages (#14066) 2022-06-23 14:18:18 -04:00
Aiden Foxx
ccd5c39301 Display error message on OAuth errors (#13184)
* Display error message on oauth errors, and notify about incorrect provider

* Updated copy

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-09 15:14:11 -04:00
Rijk van Zanten
a36c7eabeb Use json parser wrapper function to prevent pollution attacks (#13191) 2022-05-09 14:57:38 -04:00
tenebrius
62d8224af9 Convert OAuth identifier to string before calling toLowerCase (#13067)
* Convert identifier to string before calling toLowerCase

Fixes [#13066](#https://github.com/directus/directus/issues/13066)

* allow numbers for indentifier in oauth and openid user profile

* typescript fix

* handle case if email is not string

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

* typescript fix

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-03 10:35:47 -04:00
Aiden Foxx
fd668647c1 Added default role support to LDAP and allow optional role syncing (#12767)
* Added default role support to LDAP and allow optional role syncing

* Add minimal docs

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-14 11:27:17 -04:00
Aiden Foxx
26f626d552 Flatmap the oauth profile so we can use sub-values (#12457) 2022-04-05 11:14:49 -04:00
Aiden Foxx
4cb8e8f0ca Always try to rebind on healthcheck error (#12532)
* Always attempt rebind on LDAP healthcheck error

* Fix linting error

* Update api/src/auth/drivers/ldap.ts
2022-04-04 09:17:06 -04:00
Rijk van Zanten
73e6a12b98 Allow configuring overrides for the openid-client (#12088)
Resolves #11951
2022-03-11 09:45:55 -05:00
Aiden Foxx
4b4a31ad55 LDAP handle posix groups (#11799)
* Simplified user fetching by passing EqualityFilter

* Simplified LDAP fetching and added posix user/group support

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

* Renamed getAttribueValue to getEntryValue

* Update api/src/auth/drivers/ldap.ts
2022-02-23 15:48:14 -05:00
schlagmichdoch
dacce8e472 Fix anonymous binding ldap (#11750)
* fix anonymous binding ldap by correcting condition for throwing InvalidConfigException

* add anonymous bind option to docs

Co-authored-by: Dominik Tils <d.tils@studentec.de>
2022-02-23 15:47:59 -05:00
Aiden Foxx
40ec322998 Merge token claims and userinfo in openid flow (#11656)
* Merge token claims and userinfo in openid flow

* Keep linter happy
2022-02-15 17:54:59 -05:00
John Huffsmith
e7ada1f173 Moving schema and relation types into shared package (#11179)
* moving schema and relation types into shared package

* updating SchemaOverview imports

* removing duplicate import
2022-01-20 13:36:19 -05:00
Aiden Foxx
35564ff36d Removed OpenID token fetching from OAuth flow (#11079)
* Removed OpenID token fetching from OAuth and unified logging

* Removed full-stops from logging
2022-01-17 14:41:59 -05:00
Rijk van Zanten
7833160348 Add ability to configure IP extraction (#10765)
* Add ability to configure IP extraction

* Add comment on ipv4 v ipv6

* Uninstall unused is-ip package
2021-12-30 11:34:49 -05:00
Rijk van Zanten
dbf35a1736 Add ability to share items with people outside the platform (#10663)
* Add directus_shares

* Don't check for usage limit on refresh

* Add all endpoints to the shares controller

* Move route `/auth/shared` to `/shared/auth`

* Add password protection

* Add `share` action in permissions

* Add `shares/:pk/info`

* Start on shared-view

* Add basic styling for full shared view

* Fixed migrations

* Add inline style for shared view

* Allow title override

* Finish /info endpoint for shares

* Add basic UUID validation to share/info endpont

* Add UUID validation to other routes

* Add not found state

* Cleanup /extract/finish share login endpoint

* Cleanup auth

* Added `share_start` and `share_end`

* Add share sidebar details.

* Allow share permissions configuration

* Hide the `new_share` button for unauthorized users

* Fix uses_left displayed value

* Show expired / upcoming shares

* Improved expired/upcoming styling

* Fixed share login query

* Fix check-ip and get-permissions middlewares behaviour when role is null

* Simplify cache key

* Fix typescript linting issues

* Handle app auth flow for shared page

* Fixed /users/me response

* Show when user is authenticated

* Try showing item drawer in shared page

* Improved shared card styling

* Add shares permissions and change share card styling

* Pull in schema/permissions on share

* Create getPermissionForShare file

* Change getPermissionsForShare signature

* Render form + item on share after auth

* Finalize public front end

* Handle fake o2m field in applyQuery

* [WIP]

* New translations en-US.yaml (Bulgarian) (#10585)

* smaller label height (#10587)

* Update to the latest Material Icons (#10573)

The icons are based on https://fonts.google.com/icons

* New translations en-US.yaml (Arabic) (#10593)

* New translations en-US.yaml (Arabic) (#10594)

* New translations en-US.yaml (Portuguese, Brazilian) (#10604)

* New translations en-US.yaml (French) (#10605)

* New translations en-US.yaml (Italian) (#10613)

* fix M2A list not updating (#10617)

* Fix filters

* Add admin filter on m2o role selection

* Add admin filter on m2o role selection

* Add o2m permissions traversing

* Finish relational tree permissions generation

* Handle implicit a2o relation

* Update implicit relation regex

* Fix regex

* Fix implicitRelation unnesting for new regex

* Fix implicitRelation length check

* Rename m2a to a2o internally

* Add auto-gen permissions for a2o

* [WIP] Improve share UX

* Add ctx menu options

* Add share dialog

* Add email notifications

* Tweak endpoint

* Tweak file interface disabled state

* Add nicer invalid state to password input

* Dont return info for expired/upcoming shares

* Tweak disabled state for relational interfaces

* Fix share button for non admin roles

* Show/hide edit/delete based on permissions to shares

* Fix imports of mutationtype

* Resolve (my own) suggestions

* Fix migration for ms sql

* Resolve last suggestion

Co-authored-by: Oreilles <oreilles.github@nitoref.io>
Co-authored-by: Oreilles <33065839+oreilles@users.noreply.github.com>
Co-authored-by: Ben Haynes <ben@rngr.org>
Co-authored-by: Thien Nguyen <72242664+tatthien@users.noreply.github.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2021-12-23 18:51:59 -05:00
Aiden Foxx
63ade9b42f Added edge case handling for weird IBM ldap issues (#9527)
* Added edge case handling for weird IBM ldap issues

* Update api/src/exceptions/unexpected-response.ts
2021-12-10 15:07:31 -05:00
rijkvanzanten
8f05d0339a Add trace logs to OAuth2 flow 2021-12-06 13:28:46 -05:00
Aiden Foxx
f48a413bb9 SSO fixes and improvements (#10301)
* Update refresh_token on refresh, allow custom authorize params, handle invalidated tokens

* Added default to generateAuthUrl

* Apparently issuer can be undefined now

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

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

* Make linter happy
2021-12-06 13:13:24 -05:00
Aiden Foxx
6d2ab0701c Added back missing LDAP default (#10302) 2021-12-04 16:18:38 -05:00
Aiden Foxx
58bc651c85 Fixed escaping error on LDAP filters (#10297) 2021-12-04 09:18:20 -05:00
Aiden Foxx
bd551ea9e4 Fix LDAP race condition (#9993) 2021-11-23 09:37:55 -05:00
Aiden Foxx
8b9671baaa Added scope support to LDAP group and user search (#9529)
* Added scope support LDAP group and user search

* Fixed linter screwing up my markdown

* Update docs/configuration/config-options.md

* Always return correct DN for user with sub scope
2021-11-22 15:05:01 -05:00
Aiden Foxx
beed15c199 Fix issue with OAuth setting incorrect initial session data (#9964)
* Fix issue with OAuth setting incorrect initial session data

* Fix issue with OpenID setting incorrect initial session data
2021-11-22 10:44:04 -05:00
Aiden Foxx
c842b77352 Throw if OpenID provider doesn't support code flow (#9862) 2021-11-20 12:53:22 -05:00
Aiden Foxx
175dc20a1d Use access_token with openid-client to fix facebook (#9598) 2021-11-10 10:46:44 -05:00
Aiden Foxx
2f33f71a6a Added user rebinding on reconnect in LDAP (#9339)
* Added reconnect handling code for LDAP

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

* Improved error handling

* Updated re-bind so we can await it when required

* Added bind check before operations to ensure client has user

* Cleaned up reconnect handling in LDAP

* Minor cleanup

* Minor cleanup
2021-11-03 11:12:50 -04:00
Aiden Foxx
1379e8b5c9 Added openid fallback to user token info if profile URL not defined (#9368) 2021-11-02 14:09:05 -04:00
Aiden Foxx
179f06126e Added state param to oauth to make Okta happy (#9289)
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-11-01 14:04:32 -04:00
Dorian Zedler
106d207238 Feat/custom ldap mail attribute (#9307)
* Allow custom email field for LDAP

* Update docs

* Break out into variable and don't cast to String
2021-11-01 15:57:57 +00:00
Aiden Foxx
4ef7203b88 Removed undefined type from LDAP userAccountControl (#9309) 2021-11-01 11:35:23 -04:00
Aiden Foxx
b7ee318e43 LDAP auth provider (#9074)
* Added LDAP implementation

* Cleanup and added refresh checking

* Added provider check to ldap

* Added LDAP docs

* Always update LDAP user role on authentication

* Fetched package-json from github

* Fixed lint error

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

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

* Added missing locale key

* Update docs/guides/api-config.md

* Update docs/configuration/config-options.md

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

* Added back LDAP example

* Update config-options.md

* getUserID function sjhouldn't care about password

* Added LOCKOUT to INVALID_ACCOUNT_FLAGS

* Update styling approach for v-select

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-10-29 11:58:10 -04:00
Aiden Foxx
fc3e24be12 Clarified some oauth things in the docs (#9203) 2021-10-27 17:38:06 -04:00
Aiden Foxx
5f9f9cbbdc Ignore email field in oauth and store email in external_identifier (#9153)
* Ignore email field in oauth and store email in external_identifier if needed

* Removed unused variable
2021-10-26 10:07:33 -04:00
Aiden Foxx
29a2e75206 Improved invalid JWT handling (#9058)
* Improved invalid token handling in oauth flows

* Fixed cookie name
2021-10-22 10:17:12 -04:00
Aiden Foxx
fa3b1171e8 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>
2021-10-21 17:45:01 -04:00
Pascal Jufer
23a126b026 Fix eslint warnings and cleanup unused disable-directives (#8718)
* Fix eslint warnings

* Remove unused eslint disable-directives
2021-10-12 09:49:01 -04:00
Aiden Foxx
084c6117b7 Modular authentication (#6942)
* Moved refactoring from LDAP branch

* Moved Auth into packages

* Updated frontend to support custom auth providers and make implementation more flexible

* Fixed exception handling and numerous bugs. Also added provider support to graphql

* Updated frontend to be able to set provider and identifier

* Fixed issue with setting the auth provider in app

* Updated package-lock.json

* Updated package-lock.json

* Cleanup, adding type handling and disabled changing provider

* Added title formatting to SSO links

* Fixed incorrect type export

* Fixed incorrect rc

* Update api/src/services/authentication.ts

* Updated sub-dependencies to rc87

* Fixed linting errors

* Prefer sending provider name as config var

* Pass clone of user info to auth provider instead of reference

* Moved auth from packages into core

* Removed generic login handler

* Fixed graphql complaint

* Moved exception back to api and cleaned up URLs

* Minor tweak

* Pulled across improvements from openid branch

* Fixed fix that wasn't a fix

* Update auth.ts

* Update auth.ts

* Update authentication.ts

* Update login-form.vue

* Regression fixes and cleanup

* Minor flow improvements

* Flipped if and fixed linting warning

* Un-expanded object that didn't need to be expanded!

* Trimmed auth interface for consistency when verifying passwords

* Removed auth-manager, changed login endpoint, broke out SSO links, removed username support, disabled updating external_identifier, generate provider options as part of field generation

* Cleaned up some code comments

* Use named exports in local driver

* Use async defaults for auth abstract class

* Use JSON for auth_data field

* Move session data blob to directus_sessions

* Remove unused export, rename auth->authDriver

* Opinionated changes

* Move login route registration to driver file

* Revert app changes in favor of PR #8277

* Send session token to auth provider and opinionated changes

* Added missing translation

* Fixed empty elements for users without email

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

* Move pw verify to local driver, remove CRUD

* Opinions > logical reasoning

* Use session data, cleanup login method on auth serv

* Remove useless null

* Fixed breaking changes from refactor, and fixed build

* Fixed lint warning

* Ignore typescript nonsense

* Update api/src/services/authentication.ts

* Fix provider name passthrough

Co-authored-by: Aiden Foxx <aiden.foxx@sbab.se>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2021-09-27 17:18:20 -04:00