├── LICENSE ├── README.md ├── database-connections └── my-custom-db │ ├── change_password.js │ ├── create.js │ ├── delete.js │ ├── login.js │ └── verify.js ├── pages ├── error_page.html ├── error_page.json ├── guardian_multifactor.html ├── guardian_multifactor.json ├── login.html ├── login.json ├── password_reset.html └── password_reset.json └── rules ├── auth0-authz.json ├── log-to-console.js ├── log-to-console.json ├── set-country.js └── set-country.json /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Auth0 Samples 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Source Control Integration 2 | 3 | Under [Extensions](https://manage.auth0.com/#/extensions) you'll find the GitHub Deploy extension which allows you to manage your Database Connections and Rules in a GitHub repository. 4 | 5 | ## Deploying Pages 6 | 7 | For Hosted Pages you'll created an html file and a json file (for enabled/disabled status) under `pages`. Supported hosted pages: 8 | 9 | 10 | ``` 11 | error_page 12 | guardian_multifactor 13 | login 14 | password_reset 15 | ``` 16 | 17 | ## Deploying Database Connection Scripts 18 | 19 | For Database Connections you create a directory under `database-connections` which contains the name of your Database Connection (in exactly the same way as you named it in Auth0). And under this directory you'll create 1 file for every script you want to use. Only the `login` script is required in a Custom Database connection. If you enabled the migration feature, you'll also need to provide the `get_user` script. 20 | 21 | Allowed scripts: 22 | 23 | ``` 24 | get_user.js 25 | create.js 26 | verify.js 27 | login.js 28 | change_password.js 29 | delete.js 30 | ``` 31 | 32 | An example can be found [here](database-connections/my-custom-db). 33 | 34 | ## Deploying Rules 35 | 36 | For rules you'll create 1 JavasSript file for every rule you want to deploy under the `rules` directory. Eg: `rules/set-country.js`. 37 | 38 | When creating the rule the name in Auth0 will be set to `set-country`. If you plan to use Source Control integration for an existing account, make sure you rename your rules in Auth0 first to the same name of the files you'll deploy to this directory. 39 | 40 | In addition to that you might want to control the rule **order**, **status** (enabled/disabled) and **stage** (`login_success`, `login_failure`, `user_registration`). 41 | 42 | These can be controlled by creating a JSON file next to your Javascript file. Eg: 43 | 44 | **set-country.js** 45 | 46 | ```js 47 | function (user, context, callback) { 48 | if (context.request.geoip) { 49 | user.country = context.request.geoip.country_name; 50 | } 51 | 52 | callback(null, user, context); 53 | } 54 | ``` 55 | 56 | **set-country.json** 57 | 58 | ```json 59 | { 60 | "enabled": false, 61 | "order": 15, 62 | "stage": "login_success" 63 | } 64 | ``` 65 | 66 | > Note: 67 | > - Having multiple rules with the same order is not allowed. Make sure you don't have any collisions. 68 | 69 | A few examples can be found [here](rules). 70 | -------------------------------------------------------------------------------- /database-connections/my-custom-db/change_password.js: -------------------------------------------------------------------------------- 1 | function changePassword (email, newPassword, callback) { 2 | return callback(new Error('Not Implemented')); 3 | } 4 | -------------------------------------------------------------------------------- /database-connections/my-custom-db/create.js: -------------------------------------------------------------------------------- 1 | function create (user, callback) { 2 | return callback(new Error('Not Implemented')); 3 | } 4 | -------------------------------------------------------------------------------- /database-connections/my-custom-db/delete.js: -------------------------------------------------------------------------------- 1 | function remove (id, callback) { 2 | return callback(new Error('Not Implemented')); 3 | } 4 | -------------------------------------------------------------------------------- /database-connections/my-custom-db/login.js: -------------------------------------------------------------------------------- 1 | function login (email, password, callback) { 2 | return callback(new Error('Not Implemented')); 3 | } 4 | -------------------------------------------------------------------------------- /database-connections/my-custom-db/verify.js: -------------------------------------------------------------------------------- 1 | function verify (email, callback) { 2 | return callback(new Error('Not Implemented')); 3 | } 4 | -------------------------------------------------------------------------------- /pages/error_page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |Oops!
10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/error_page.json: -------------------------------------------------------------------------------- 1 | { 2 | "enabled": true 3 | } 4 | -------------------------------------------------------------------------------- /pages/guardian_multifactor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |