-
Notifications
You must be signed in to change notification settings - Fork 428
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
Multi tenancy auth #3063
Multi tenancy auth #3063
Conversation
to run test execute: test-runner.sh --skip-cover --skip-small-tests --preset pgsql_mnesia --db pgsql -- dynamic_domains_pm:can_authenticate
Codecov Report
@@ Coverage Diff @@
## multi-tenancy-phase-1 #3063 +/- ##
=========================================================
+ Coverage 78.09% 78.71% +0.61%
=========================================================
Files 374 386 +12
Lines 31219 31643 +424
=========================================================
+ Hits 24382 24909 +527
+ Misses 6837 6734 -103
Continue to review full report at Codecov.
|
d7f064a
to
135fec2
Compare
…se_domain_core_SUITE:init_per_testcase/2
esuring dialyzer is not complaning: ./rebar3 dialyzer
dd90346
to
a39052b
Compare
46c4ef3
to
7d46418
Compare
introducing the new callback supported_features/0: * for now there is the only one optional feature - dynamic_domains. * currently only ejabberd_auth_dummy supports dynamic_domains feature. * all other auth modules must be rechecked and adopted in order to support dynamic_domains feature. * the following things must be done per auth module: - recheck that ejabberd_auth set_opts and get_opt interfaces are used with host type, not domain name. - recheck that mongoose_scram interfaces are used with host type, not domain name. - recheck that ejabberd_config get_local_option interfaces are used with host type, not domain name. - create proper tests to ensure that auth module works correctly with dynamic domains. commit verified with the following commands: test-runner.sh --skip-cover --skip-small-tests --preset pgsql_mnesia --db pgsql -- dynamic_domains_pm:can_authenticate ./rebar3 dialyzer
verified with commands: tools/setup-redis.sh ./rebar3 ct
tested with this command: ./rebar3 ct --suite auth_dummy_SUITE --case supports_dynamic_domains
tested with command: ./rebar3 ct --suite config_parser_SUITE --group host_types_group
it causes execution of meck:unload in parallel which results in spontaneous failuers. tested with: ./rebar3 ct --suite config_parser_SUITE
7e97adb
to
a2843c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of good work! Just a few comments from me.
Also: please take care of the failing tests and update the description.
@@ -29,6 +29,7 @@ | |||
tls_options = [], | |||
tls_verify :: verify_none | verify_peer, | |||
authenticated = false :: authenticated_state(), | |||
host_type = <<>> :: binary(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to set an empty host type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise, dialyzer complains :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... maybe it has a reason to complain? What is the error? If it's in tests, then ok, but are you sure that we won't get an empty binary for an online user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it complains that undefined
is not binary() type. and nope - we won't have it empty for an online user.
we set a valid host_type at the very early stage of a session, actually authentication is impossible without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be binary() | undefined
type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it will complain about usage of undefined
type everywhere where only binary() is expected.
There is no problem with the current type definition, there is no problem with the default value either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like what @arcusfelis suggested. Dialyzer does not complain, I checked it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dialyzer doesn't complain about it right now, because we don't really use that field yet. But we will start in the following PRs, I'm absolutely against this change. Dialyzer is not smart enough to understand FSM lifecycle and understand that in some state it cannot be undefined any more.
empty binary is the same illegal value for the host type as undefined, we cannot configure it in toml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think Dialyzer would not complain because of how success typing works. However, it is a minor thing for me and I can merge the changes as they are now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did some extra tests, looks you're right. will change it in the following PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable
This PR introduces the new callback supported_features/0 for auth backends:
support this feature.
used with host type, not domain name.
not domain name.
used with host type, not domain name.
with dynamic domains.
In order to reduce the number of calls to
mongoose_domain_api:get_host_type/1
HostType parameter is added to some callbacks of ejabberd_gen_auth behaviour.