docsifyjs / docsifyjs/docsify

Proposal: protect docs with user authentication

Ouverte
#2,011 2 commentaires 5 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
31.5k
Forks
5.8k
Merge moyen
9 j 8 h
PR mergées (30 j)
2

Description

## 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"
}
```

2) 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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by mapping the proposed auth.json configuration and the npx docsify-protect-docs entry point to the generated docs/protected folder and modified index.html. Review how Docsify handles its docs root and authentication-related flows; done means the proposal's initialization, protected output, GitHub authentication, and on-the-fly decryption workflow are defined and working.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
github, javascript
Domaine
authentication, cli, documentation, security
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.