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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add instructions on content protection #7064

Closed
wants to merge 1 commit into from
Closed

docs: add instructions on content protection #7064

wants to merge 1 commit into from

Conversation

pizzaz93
Copy link

Provide guidance for content protection options, this is based on a request and content in #6890.

Provide guidance for content protection options
@facebook-github-bot
Copy link
Contributor

Hi @pizzaz93!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@pizzaz93
Copy link
Author

pizzaz93 commented Mar 30, 2022

I just signed the CLA may take a few minutes to propagate.

@netlify
Copy link

netlify bot commented Mar 30, 2022

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 64e66e0
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62439f88c1fa8800085a2ffd
😎 Deploy Preview https://deploy-preview-7064--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 61
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-7064--docusaurus-2.netlify.app/

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 30, 2022
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

I have a feeling that you don't fully understand the implications behind "Docusaurus authentication", but anyways, spending more time on this would be worthwhile :)


2. Cookie or OAuth workflow, CDNs with edge serverless functions support this feature set. For example, using [Cloudflare](#deploying-to-cloudflare-pages) workers an authentication workflow like [GitHub Oauth](https://github.com/gr2m/cloudflare-worker-github-oauth-login) can be implemented.

3. A self service option, implementing client-side rendering routes and fetching content from a protected API, [Gatsby.js](https://www.gatsbyjs.com/docs/how-to/routing/client-only-routes-and-user-authentication) is an example of this pattern.
Copy link
Collaborator

@Josh-Cena Josh-Cena Mar 30, 2022

Choose a reason for hiding this comment

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

While I'm okay to have the other two in the documentation (though not very happy to), this is a part that we should NOT include. Gatsby is a direct replacement for Docusaurus. We are interested in how we can do it, not how they do it.

  • addRoute({path: "/admin/*",component: "@site/src/Admin"})
  • Admin should statically render a spinner or login page on the server => /admin/index.html
  • add Netlify redirect from /admin/* to /admin/index.html (for all i18n languages)
  • Use client-side route components in Admin after mount
  • Use API with authentication to fetch data at runtime in Admin routes

This part is the most relevant in #958 (comment) and what I feel like the most worthy—all the other stuff is actually just "references" or "status quo". However, this instruction is quite vague—you probably need to actually implement that first as POC, and from there we can discuss which parts to include in the documentation.

Copy link
Author

Choose a reason for hiding this comment

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

@Josh-Cena in terms of implementing a POC that would probably be beyond me, in scoping this pull request as a documentation add would we want to add those first two items?
Or alternatively reverting this PR and bundling that POC and documentation edit in one PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

TBF, I'm not entirely sure how we would progress. The first two points can be sufficient for a lot of users, but without the third point (written in a clear and instructive way) the doc seems obviously incomplete. Let's hold it as this until I (or someone else) figure out a way to move forward.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, having a POC seems useful otherwise we are advising things that we didn't even try 😅

@Josh-Cena Josh-Cena changed the title Provide guidance for content protection options docs: add instructions on content protection Apr 3, 2022
@Josh-Cena Josh-Cena added the pr: documentation This PR works on the website or other text documents in the repo. label Apr 3, 2022

1. Password protection, some static hosts and CDNs offer this service. For example, [Netlify](#deploying-to-netlify) provides a [password based]( https://docs.netlify.com/visitor-access/password-protection/) function for controlling content access.

2. Cookie or OAuth workflow, CDNs with edge serverless functions support this feature set. For example, using [Cloudflare](#deploying-to-cloudflare-pages) workers an authentication workflow like [GitHub Oauth](https://github.com/gr2m/cloudflare-worker-github-oauth-login) can be implemented.
Copy link
Collaborator

Choose a reason for hiding this comment

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

technically edge serverless permits anything (including any SSO, Oauth, SAML, htaccess/password protection...) and it's what CDNs use themselves to handle 1). It's a bit like 1 and 2 are the same case somehow. Wonder what's the best way to present that.

@dprothero
Copy link

FWIW, I have implemented an Okta integration on top of a Docusaurus site hosted by Netlify using this library.

@pizzaz93 pizzaz93 closed this May 3, 2022
@pizzaz93 pizzaz93 deleted the patch-1 branch May 3, 2022 20:33
@massoudmaboudi
Copy link
Contributor

You may check my articles that show how to add an authentication layer to your Docusuaurs website.

https://iammassoud.net/blog/docusaurus-authentication-roadmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants