directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
505 stars 204 forks source link

Cannot add custom auth provider #1718

Open TechInterMezzo opened 4 years ago

TechInterMezzo commented 4 years ago

Bug Report

If I add any other auth provider than one of the core extensions (facebook, google, etc.) the array at the following line of code is returned empty:

https://github.com/directus/directus/blob/c894e6730a20172c578457f54ad00516fdb583c9/src/core/Directus/Application/CoreServicesProvider.php#L752

So I can't register any custom auth provider.

Could it be that the config schema is the source of the problem? I can just guess at the moment that everything that is not part of the scheme gets removed from the config at runtime.

https://github.com/directus/directus/blob/c894e6730a20172c578457f54ad00516fdb583c9/src/core/Directus/Config/Schema/Schema.php#L120

hemratna commented 4 years ago

I think Auth Providers will help you.

hemratna commented 4 years ago

you can enable any of our Single Sing-On (SSO) services or create your own adapter for custom authentication. Directus also supports SCIM for external user management.

As mentioned on doc Directus only support Okta, Github, Facebook, Google, Twitter for SSO. But you can write your own adapter for custom authentication.

This is expected Directus behavior.

TechInterMezzo commented 4 years ago

As mentioned on doc Directus only support Okta, Github, Facebook, Google, Twitter for SSO. But you can write your own adapter for custom authentication.

This is expected Directus behavior.

There is even a line of code that clearly states that you are expecting your own core SSO adapters and custom ones:

$coreSso = \Directus\get_custom_x('auth', 'public/extensions/core/auth', true);
$customSso = \Directus\get_custom_x('auth', 'public/extensions/custom/auth', true);

But the custom ones can't be used because of the bug I reported at the top. And how should I even implement my own adapter if not by using a custom auth.php and provider class?

benhaynes commented 4 years ago

Can we confirm that the custom ones work? I'll reopen this in the meantime.

hemratna commented 4 years ago

@TechInterMezzo Yes, You are right, We are only accepting the config defined in https://github.com/directus/directus/blob/c894e6730a20172c578457f54ad00516fdb583c9/src/core/Directus/Config/Schema/Schema.php#L120 All the additional configs are removed.

Ref https://github.com/directus/docker/issues/78 https://github.com/directus/api/issues/1468

mathielen commented 4 years ago

Yes, same problem I was facing in #1902. Would be nice if "unknown" social_provider-configs would be allowed there...