Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard): add SSO feature and integrate with LDAP #11631

Merged
merged 4 commits into from Sep 20, 2023

Conversation

lafirest
Copy link
Member

@lafirest lafirest commented Sep 19, 2023

Fixes

Summary

馃 Generated by Copilot at 2cddce5

This pull request adds a new application emqx_dashboard_sso to the enterprise edition of EMQX, which provides the functionality of single sign-on for the EMQX dashboard. It implements different single sign-on backends, such as LDAP, and integrates them with the existing emqx_dashboard and emqx_dashboard_admin modules. It also adds the necessary configuration, documentation, license, and internationalization files for the new application.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Added property-based tests for code which performs user input validation
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • Created PR to emqx-docs if documentation update is required, or link to a follow-up jira ticket
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

apps/emqx_dashboard_sso/README.md Outdated Show resolved Hide resolved
apps/emqx_dashboard_sso/README.md Outdated Show resolved Hide resolved
@lafirest lafirest force-pushed the feat/dashboard_ldap branch 2 times, most recently from b52ede0 to 3643424 Compare September 20, 2023 02:10
@lafirest lafirest marked this pull request as ready for review September 20, 2023 03:28
@lafirest lafirest requested a review from a team as a code owner September 20, 2023 03:28
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 6243352479

  • 37 of 221 (16.74%) changed or added relevant lines in 11 files are covered.
  • 35 unchanged lines in 13 files lost coverage.
  • Overall coverage decreased (-0.4%) to 81.686%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/emqx_ldap/src/emqx_ldap.erl 3 4 75.0%
apps/emqx_dashboard_sso/src/emqx_dashboard_sso_app.erl 0 2 0.0%
apps/emqx_dashboard_sso/src/emqx_dashboard_sso_sup.erl 0 2 0.0%
apps/emqx_dashboard/src/emqx_dashboard_token.erl 1 4 25.0%
apps/emqx_dashboard_sso/src/emqx_dashboard_sso_schema.erl 6 10 60.0%
apps/emqx_dashboard/src/emqx_dashboard_admin.erl 5 11 45.45%
apps/emqx_dashboard_sso/src/emqx_dashboard_sso.erl 3 10 30.0%
apps/emqx_dashboard/src/emqx_dashboard_api.erl 14 22 63.64%
apps/emqx_dashboard_sso/src/emqx_dashboard_sso_ldap.erl 3 37 8.11%
apps/emqx_dashboard_sso/src/emqx_dashboard_sso_api.erl 2 44 4.55%
Files with Coverage Reduction New Missed Lines %
apps/emqx_bridge_gcp_pubsub/src/emqx_bridge_gcp_pubsub_impl_consumer.erl 1 90.24%
apps/emqx_dashboard/src/emqx_dashboard_desc_cache.erl 1 94.44%
apps/emqx_ft/src/emqx_ft_assembler.erl 1 85.11%
apps/emqx_ft/src/emqx_ft_storage_exporter.erl 1 88.24%
apps/emqx_ft/src/emqx_ft_storage_fs.erl 1 82.84%
apps/emqx/src/emqx_quic_stream.erl 1 75.0%
apps/emqx_bridge_gcp_pubsub/src/emqx_bridge_gcp_pubsub_consumer_worker.erl 2 93.88%
apps/emqx_dashboard/src/emqx_dashboard_api.erl 2 61.61%
apps/emqx_resource/src/emqx_resource_buffer_worker.erl 2 93.54%
apps/emqx/src/emqx_trace/emqx_trace.erl 2 87.72%
Totals Coverage Status
Change from base Build 6233018834: -0.4%
Covered Lines: 33153
Relevant Lines: 40586

馃挍 - Coveralls

@lafirest lafirest merged commit bc6edac into emqx:master Sep 20, 2023
132 checks passed
@lafirest lafirest deleted the feat/dashboard_ldap branch September 20, 2023 03:40
Provider = emqx_dashboard_sso:provider(Backend),
case emqx_dashboard_sso:login(Provider, Sign, State) of
{ok, Token} ->
?SLOG(info, #{msg => "Dashboard SSO login successfully", request => Sign}),
Copy link
Member

Choose a reason for hiding this comment

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

dashboard_sso_login_succeeded

{role,
mk(binary(), #{desc => ?DESC(role), default => ?ROLE_DEFAULT, example => ?ROLE_DEFAULT})};
field(backend) ->
{backend, mk(binary(), #{desc => ?DESC(backend), example => <<"local">>})}.
Copy link
Member

Choose a reason for hiding this comment

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

enum?

fun(Key, Acc) ->
case maps:find(Key, Config) of
{ok, Value} when is_binary(Value) ->
Acc#{Key := erlang:binary_to_list(Value)};
Copy link
Member

Choose a reason for hiding this comment

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

why is 'timeout' a s string?
maybe add a comment here.

emqx_utils_ets:new(
dashboard_sso,
[
set,
Copy link
Member

Choose a reason for hiding this comment

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

ordered_set.

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.

None yet

5 participants