diff --git a/doc/user-guide/password.md b/doc/user-guide/password.md index cd0920a9..de1cf67e 100644 --- a/doc/user-guide/password.md +++ b/doc/user-guide/password.md @@ -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 +``` + +Where `` 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 +``` + +### 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 @@ -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 @@ -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 :::