-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Conversation
Provide guidance for content protection options
Hi @pizzaz93! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
I just signed the CLA may take a few minutes to propagate. |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-7064--docusaurus-2.netlify.app/ |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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 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. |
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.
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.
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.
@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.
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.
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.
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.
yes, having a POC seems useful otherwise we are advising things that we didn't even try 😅
|
||
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. |
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.
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.
FWIW, I have implemented an Okta integration on top of a Docusaurus site hosted by Netlify using this library. |
You may check my articles that show how to add an authentication layer to your Docusuaurs website. https://iammassoud.net/blog/docusaurus-authentication-roadmap |
Provide guidance for content protection options, this is based on a request and content in #6890.