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 6 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
87 changes: 78 additions & 9 deletions doc/user-guide/password.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,77 @@ 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.

### Adding Authentication
edublancas marked this conversation as resolved.
Show resolved Hide resolved

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.
edublancas marked this conversation as resolved.
Show resolved Hide resolved
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.

### 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.

### Example Usage

```bash
# Add authentication for a specific feature
ploomber-cloud auth --add --feature main_app

# Remove authentication for a specific feature
ploomber-cloud auth --remove --feature analytics

# Add authentication with overwrite option
ploomber-cloud auth --add --feature api --overwrite
edublancas marked this conversation as resolved.
Show resolved Hide resolved
```

(auth0-integration)=
## Auth0 authentication

Expand Down Expand Up @@ -133,7 +204,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,33 +244,32 @@ 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
:link: <https://github.com/ploomber/doc/tree/main/examples/panel/app-with-auth0>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these <> broke the links https://ploomber-doc--283.org.readthedocs.build/en/283/user-guide/password.html#examples

be careful when making these changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think these <> broke the links https://ploomber-doc--283.org.readthedocs.build/en/283/user-guide/password.html#examples

be careful when making these changes

removed

izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

:::{grid-item-card} Solara
:link: https://github.com/ploomber/doc/tree/main/examples/solara/app-with-auth0
:link: <https://github.com/ploomber/doc/tree/main/examples/solara/app-with-auth0>
izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

:::{grid-item-card} Streamlit
:link: https://github.com/ploomber/doc/tree/main/examples/streamlit/app-with-auth0
:link: <https://github.com/ploomber/doc/tree/main/examples/streamlit/app-with-auth0>
izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

:::{grid-item-card} Shiny R
:link: https://github.com/ploomber/doc/tree/main/examples/shiny-r/app-with-auth0
:link: <https://github.com/ploomber/doc/tree/main/examples/shiny-r/app-with-auth0>
izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

:::{grid-item-card} Chainlit
:link: https://github.com/ploomber/doc/tree/main/examples/chainlit/app-with-auth0
:link: <https://github.com/ploomber/doc/tree/main/examples/chainlit/app-with-auth0>
izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

:::{grid-item-card} Dash
:link: https://github.com/ploomber/doc/tree/main/examples/dash/app-with-auth0
:link: <https://github.com/ploomber/doc/tree/main/examples/dash/app-with-auth0>
izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

:::{grid-item-card} Voila
:link: https://github.com/ploomber/doc/tree/main/examples/voila/app-with-auth0
:link: <https://github.com/ploomber/doc/tree/main/examples/voila/app-with-auth0>
izi-on marked this conversation as resolved.
Show resolved Hide resolved
:::

::::