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

Proposal: protect docs with user authentication #2011

Open
jlcastillo opened this issue Apr 2, 2023 · 0 comments
Open

Proposal: protect docs with user authentication #2011

jlcastillo opened this issue Apr 2, 2023 · 0 comments
Milestone

Comments

@jlcastillo
Copy link

jlcastillo commented Apr 2, 2023

Feature request

Protect docsify static pages with user authentication from any 3rd party identity provider (i.e. Github Auth).

What problem does this feature solve?

Store and serve static docs in free services like Github Pages, while having user authentication. Github only allows that in their paid layer. The proposed method would work with any hosting and identity provider.

What does the proposed API look like?

  1. Create an auth.json file in your root folder with these contents:
{
   auth: "github",
   repo: "private-repo-id"
}
  1. In your docsify docs root folder, run npx docsify-protect-docs

How should this be implemented in your opinion?

  1. Initialization:
    The command npx docsify-protect-docs, when called without arguments, will create a git pre-push or pre-commit hook that will automatically call npx docsify-protect-docs now (notice argument now).

  2. Automated workflow:
    With argument now, the script will create a "./docs/protected" folder, with all the encrypted markdown files and with a modified version of index.html that shows a Login form and connects to Github Auth for auth.

  3. On-the-fly decryption:
    The decryption key is obtained from the private Github repo, where it was previously placed by npx docsify-protect-docs now. In order to access this key, we need to require read access to that repo. The user will grant it as part of his github auth login flow.

Security:
Only users with access to the private repo would be able to able to read the docs. Which is fine since they can read the plain markdown anyway.

Utility
Right now the method would be specially useful for developers, as they would need a Github ID (easily extended for Gitlab and other git providers). For non-developers, other identity providers may be added, but they would need to somehow provide access to a shared decryption key.

Are you willing to work on this yourself?

Maybe, if I get support so that I don't have to learn all the Docsify codebase.

@Koooooo-7 Koooooo-7 added this to the Future milestone Mar 4, 2024
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

No branches or pull requests

2 participants