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

[Feature] Documentation for nginx authentication with the CLI #283

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 66 additions & 2 deletions doc/user-guide/password.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,72 @@ To enable it, simply turn the option on and set a user and a password:
Your password isn't visible after deployment so write it down!
```

## Basic Password Protection with the CLI

Ploomber Cloud allows you to add authentication for specific features of your application using the CLI. This provides an additional layer of security for sensitive parts of your project.

### Example Usage

```bash
# Add authentication for the main application
ploomber-cloud auth --add --feature main_app
```

### Adding Authentication

To add authentication for a specific feature, use the following command:

```bash
ploomber-cloud auth --add --feature <feature_name>
```

Where `<feature_name>` is one of the supported features compatible with authentication.

If you don't specify a feature, you will be prompted to select one from the available options.

### Options

- `--overwrite`: Use this flag to overwrite existing authentication fields if they already exist.

### Removing Authentication

To remove authentication for a specific feature, use:

```bash
ploomber-cloud auth --remove --feature <feature_name>
```

### Important Notes

1. You can only add or remove authentication at a time, not both simultaneously.
2. At least one action (add or remove) must be specified.
3. The `--overwrite` flag can only be used when adding authentication, not when removing.

### Authentication Process

When adding authentication:

1. You will be prompted to enter a username and password for the selected feature.
2. If credentials already exist in the `.env` file and `--overwrite` is not used, those credentials will be reused.
3. The credentials are stored in the `.env` file in your project directory.
4. The authentication configuration is added to the Ploomber Cloud configuration file (`ploomber-cloud.json`).

### Credential Storage

- Credentials are stored in the `.env` file in your project directory.
- The Ploomber Cloud configuration file is updated with the authentication settings.

### Warnings and Messages

- If existing credentials are reused from the `.env` file, you will receive a warning message.
- After successful authentication configuration, you will see a confirmation message and instructions for the next steps.

### Permissions

The `auth` command requires the user's tier to have the "authentication" permission to execute.
You will need to upgrade if necessary.


(auth0-integration)=
## Auth0 authentication

Expand Down Expand Up @@ -133,7 +199,6 @@ To log out a user, you can create a link to the `/logout` endpoint.

Here's an example using **Panel**:


```python
import panel as pn

Expand Down Expand Up @@ -174,7 +239,6 @@ You can set the following variables in your `.env` file to customize behavior:
:class-container: text-center
:gutter: 2


:::{grid-item-card} Panel
:link: https://github.com/ploomber/doc/tree/main/examples/panel/app-with-auth0
:::
Expand Down