<commit_before># Auth0 Slack MFA Extension
The Slack MFA Extension will send Slack messages containing a magic link to your users.  Once the
user clicks the magic link they will complete their login process.


## Installation

## Setting up MongoDB

The Slack MFA extension utilizes MongoDB to store a whitelist of valid JWT's.  Each JWT is a onetime use 
token that is revoked after it is used.  MongoDB manages the whitelist, which is shared by the rule and the extension.

- Setup a collection named: `Token`
- Create a unique index for _id:
```
{
  "v": 1,
  "key": {
    "_id": 1
  },
  "name": "_id_",
  "ns": "<db-name>.Token"
}
```

- Create a TTL Index for the collection:

```
{
  "v": 1,
  "key": {
    "issued": 1
  },
  "name": "token-cleanse",
  "ns": "<db-name>.Token",
  "background": true,
  "expireAfterSeconds": 300
}
```

## Getting a Slack API Token

This key is used to send direct messages to members of your Slack Team.  To acquire and API token you must create a new [custom bot user](https://my.slack.com/services/new/bot) or using an existing one.
It is better to setup a specific bot for this activity.  The MFA magic links will be sent to you users on behalf of the bot.

## Installing the extension

Go to the [Extensions](https://manage.auth0.com/#/extensions) tab of the dashboard.

![](/media/step1-extensions-overview.png)

Click **CREATE EXTENSION** and install the extension from this repository: https://github.com/auth0-extensions/auth0-slack-mfa

![](/media/step2-extension-link.png)

Finally enter your Box and Auth0 settings:

 - `SLACK_API_TOKEN`: Your teams Slack API Key
 - `MONGO_CONNECTION_STRING`: The connection string for you MongoDB instance.

 
 # TODO:
 - [ ] Script out the creation of a mongodb collection and ttl index.
 - [ ] Get assets for logos.
 - [ ] Deploy assets to cdn so help screen is useful
 - [ ] Pull rule's configuration from the extension API instead of hard coding it.<commit_msg>Updating readme to remove manual setup for mongo.<commit_after># Auth0 Slack MFA Extension
The Slack MFA Extension will send Slack messages containing a magic link to your users.  Once the
user clicks the magic link they will complete their login process.


## Installation

## Getting a Slack API Token

This key is used to send direct messages to members of your Slack Team.  To acquire and API token you must create a new [custom bot user](https://my.slack.com/services/new/bot) or using an existing one.
It is better to setup a specific bot for this activity.  The MFA magic links will be sent to you users on behalf of the bot.

## Installing the extension

Go to the [Extensions](https://manage.auth0.com/#/extensions) tab of the dashboard.

![](/media/step1-extensions-overview.png)

Click **CREATE EXTENSION** and install the extension from this repository: https://github.com/auth0-extensions/auth0-slack-mfa

![](/media/step2-extension-link.png)

Finally enter your Box and Auth0 settings:

 - `SLACK_API_TOKEN`: Your teams Slack API Key
 - `MONGO_CONNECTION_STRING`: The connection string for you MongoDB instance.

 ### The extension will setup a mongo collection

The Slack MFA extension utilizes MongoDB to store a whitelist of valid JWT's.  Each JWT is a onetime use 
token that is revoked after it is used.  This extension will automatically setup a mongo collection for
managing these tokens.  It will..

- Create a collection named: `Token`
- Create a unique index for _id (this should exist by default):
```
{
  "v": 1,
  "key": {
    "_id": 1
  },
  "name": "_id_",
  "ns": "<db-name>.Token"
}
```

- Create a TTL Index for the collection:

```
{
  "v": 1,
  "key": {
    "issued": 1
  },
  "name": "token-cleanse",
  "ns": "<db-name>.Token",
  "background": true,
  "expireAfterSeconds": 300
}
```
 
 # TODO:
 - [ ] Script out the creation of a mongodb collection and ttl index.
 - [ ] Get assets for logos.
 - [ ] Deploy assets to cdn so help screen is useful
 - [ ] Pull rule's configuration from the extension API instead of hard coding it.
{'fraction_non_alphanumeric': 0.10037359900373599, 'fraction_numerical': 0.006973848069738481, 'mean_word_length': 3.6806526806526807, 'pattern_counts': {'":': 24, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3446305', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1191, 'n_words': 540}