Skip to content

Use provider specific settings#1

Merged
jkakavas merged 8 commits intojkakavas:oidc-auth-provider2from
kobelb:oidc-auth-provider2
May 21, 2019
Merged

Use provider specific settings#1
jkakavas merged 8 commits intojkakavas:oidc-auth-provider2from
kobelb:oidc-auth-provider2

Conversation

@kobelb
Copy link
Copy Markdown

@kobelb kobelb commented May 21, 2019

The approach which we originally implemented where we extended from AuthenticationProviderOptions wasn't playing nicely with TypeScript. Long-term, we should allow auth providers to specify their config schema and ideally use something like kbn-config-schema to generate types from these. However, we're not quite there yet, so we're stuck with type AuthenticationProviderSpecificOptions = Record<string, unknown> for the time being and doing the type checking in the auth provider constructor itself (even though the schema itself should prevent this from ever being needed).

I also made some changes to make the xpack.security.authc.oidc.realm required using Joi when xpack.security.authProviders contains 'oidc'.

@jkakavas
Copy link
Copy Markdown
Owner

Thanks @kobelb ! LGTM, but I'll give Larry the chance to go through it too before applying

Copy link
Copy Markdown

@legrego legrego left a comment

Choose a reason for hiding this comment

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

LGTM!

throw new Error('Realm name must be specified');
}

if (type(oidcOptions.realm) !== 'string') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not a criticism, just a question: what does this give us over the built in typeof operator?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

For string type checking, we could just use typeof directly, it mainly comes in handy for those “gotcha types”.

@jkakavas jkakavas merged commit ca0e89b into jkakavas:oidc-auth-provider2 May 21, 2019
@kobelb kobelb deleted the oidc-auth-provider2 branch May 21, 2019 18:13
jkakavas pushed a commit that referenced this pull request May 29, 2019
* Introduce new convention for config definition.

We need to define a way to acquire configuration schema as a part of
plugin definition. Having schema we can split steps of
config validation and plugin instantiation.

* Discover plugins, read their schema and validate the config.

Config validation finished before core services and plugins read from it.
That allows us to fail fast and have predictable validation results.

* Instantiate plugins using DiscoveredPluginsDefinitions.

* Update tests for new API.

* test server is not created if config validation fails

* move plugin discovery to plugin service pre-setup stage.

Set validation schemes in ConfigService.preSetup stage.

* fix eslint problem

* generate docs

* address Rudolfs comments

* separate core services and plugins validation

* rename files for consistency

* address comments for root.js

* address comments #1

* useSchema everywhere for consistency. get rid of validateAll

* plugin system runs plugin config validation

* rename configDefinition

* move plugin schema registration in plugins plugins service

plugins system is not setup when kibana is run in optimizer mode,
so config keys aren't marked as applied.

* cleanup

* update docs

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants