Skip to content

Expose anonymous access through a switch in sharing menu#86965

Merged
streamich merged 31 commits intoelastic:masterfrom
streamich:anon-access-switch
Jan 28, 2021
Merged

Expose anonymous access through a switch in sharing menu#86965
streamich merged 31 commits intoelastic:masterfrom
streamich:anon-access-switch

Conversation

@streamich
Copy link
Copy Markdown
Contributor

@streamich streamich commented Dec 28, 2020

Summary

Closes #83650

See "Release note" below for more info.

How to test

To test this feature, you should add the following to your kibana.yml:

xpack.security.authc.providers:
  basic.basic1:
    order: 0
  anonymous.anonymous1:
    order: 1
    credentials:
      username: "anonymous"
      password: "anonymous"

Then you will need to create a Kibana user with username anonymous and password anonymous. You can also create a dedicated Kibana role for the anonymous user, in that role you need to give "read" access to anonymous user for Dashboard, Discover and Visualize apps; and you need to give that user also access to Kibana Index Patterns. And you should be able to create URLs that can be accessed anonymously.

Checklist

Delete any items that are not applicable to this PR.

For maintainers


Release note

Anonymous authentication feature is now exposed in Dashboard, Discover and Visualize apps in the sharing menu. If you enable an anonymous user with read access for Dashboard, Discover or Visualize apps you can create a sharing link which allows unauthenticated anonymous user to view those apps if you check "Public URL" switch in the sharing menu.

image

image

image

image

image

@streamich streamich changed the title feat: 🎸 add "Public URL" switch Expose anonymous access through a switch in sharing menu Jan 21, 2021
@streamich streamich marked this pull request as ready for review January 21, 2021 12:13
@streamich streamich requested a review from a team January 21, 2021 12:13
@streamich streamich requested review from a team as code owners January 21, 2021 12:13
@azasypkin
Copy link
Copy Markdown
Contributor

ACK: reviewing...

Copy link
Copy Markdown
Contributor

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

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

Did initial review pass, looks great! Left a few nits and questions.

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

Copy link
Copy Markdown
Contributor

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

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

LGTM from the security perspective, tested locally and everything seems to be working as expected, thanks!

I'm only not sure about the text for Public URL and hint, @arisonl is going to confirm that for us. But we can tune it at any time anyway.

@streamich
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

Just a few nits. Thanks @streamich !

@streamich
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@arisonl
Copy link
Copy Markdown
Contributor

arisonl commented Jan 28, 2021

@azasypkin @streamich Looks great, we should turn the hint message into something more generic than just dashboards. E.g.:
"Use public URL to share your [visualizations, dashboards and Discover] with anyone, [without requiring them to login]" or perhaps "Use public URL to share your [Kibana assets] with anyone. [It enables one-step access by removing the prompt to login or access as a guest]". Mix-and-match whatever is in brackets. @gchaps what do you think?

@arisonl
Copy link
Copy Markdown
Contributor

arisonl commented Jan 28, 2021

Another idea would be to make this toggle available but disabled when anonymous access is not set up, so that we create awareness about the feature. The hint should be different in that case. By talking to @azasypkin this sounds like it is not of trivial effort, hence we can consider it later, if the need comes up. @streamich

Copy link
Copy Markdown
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Kibana app changes LGTM - tested the feature and everything behaves as expected.

One nit:
The tooltip in the share menu talks about "the dashboard" - this is a bit confusing in discover and visualize. Can we change the wording to be more generic or pass in a configuration for this?
Screenshot 2021-01-28 at 13 59 38

Copy link
Copy Markdown
Contributor

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM

@streamich
Copy link
Copy Markdown
Contributor Author

@arisonl @flash1293 I've adjusted the tooltip copy as suggested.

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 159.9KB 160.1KB +223.0B
discover 412.8KB 413.0KB +219.0B
visualize 97.5KB 97.7KB +223.0B
total +665.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
share 69.9KB 73.2KB +3.3KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@gchaps
Copy link
Copy Markdown
Contributor

gchaps commented Jan 28, 2021

Based on what @arisonl said, my recommendation is:

Use Public URL to Share your visualizations, dashboards, and searches with anyone, without requiring them to log in.

I noticed that the tooltips for the Permalink link items are widely inconsistent. I'll file an issue with suggestions for improvements.

streamich added a commit that referenced this pull request Jan 30, 2021
…9610)

* feat: 🎸 add "Public URL" switch

* feat: 🎸 add url subtitle

* feat: 🎸 add public URL toggle state

* feat: 🎸 allow to dynamically enable anonymous access switch

* feat: 🎸 add anon access url parameters to share url

* fix: 🐛 correctly add params to url

* fix: 🐛 correctly add anon access to saved object URL

* fix: 🐛 don't generate anon access urls twice

* feat: 🎸 add ability to check anonymous user capabilities

* feat: 🎸 add capability checks to Discover and Visualize apps

* refactor: 💡 use early return

* test: 💍 use security_oss mocks

* feat: 🎸 add anon access url params to short url

* test: 💍 fix jest snapshots

* perf: ⚡️ make capabilities check synchronous

* style: 💄 add stylistic review changes

* perf: ⚡️ don't fetch anon user capabilities if anon not enabled

* fix: 🐛 in discover app check if discover exists in capabilities

* test: 💍 add tests for discover sharing check

* test: 💍 add tests for showPublicUrlSwitch checks

* feat: 🎸 make visualize capabilities props required

* style: 💄 remove unused import

* feat: 🎸 improve tooltip copy

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate anonymous access into Embed Code and Permalinks share panels

10 participants