Adds TOTP setup with QR code, login challenge, recovery codes and trusted devices that let a browser skip the second factor for 30 days. Admins can reset another user's second factor by confirming with their own password.
62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
/**
|
|
* Policy Mappings
|
|
* (sails.config.policies)
|
|
*
|
|
* Policies are simple functions which run **before** your actions.
|
|
*
|
|
* For more information on configuring policies, check out:
|
|
* https://sailsjs.com/docs/concepts/policies
|
|
*/
|
|
|
|
module.exports.policies = {
|
|
/**
|
|
*
|
|
* Default policy for all controllers and actions, unless overridden.
|
|
* (`true` allows public access)
|
|
*
|
|
*/
|
|
|
|
'*': ['is-authenticated', 'is-external'],
|
|
|
|
'config/show': ['is-authenticated', 'is-admin'],
|
|
'config/update': ['is-authenticated', 'is-admin'],
|
|
'config/test-smtp': ['is-authenticated', 'is-admin'],
|
|
|
|
'webhooks/index': ['is-authenticated', 'is-external', 'is-admin'],
|
|
'webhooks/create': ['is-authenticated', 'is-external', 'is-admin'],
|
|
'webhooks/update': ['is-authenticated', 'is-external', 'is-admin'],
|
|
'webhooks/delete': ['is-authenticated', 'is-external', 'is-admin'],
|
|
|
|
'access-tokens/delete': ['is-authenticated', 'is-external', 'is-session'],
|
|
|
|
'users/index': 'is-authenticated',
|
|
'users/create': ['is-authenticated', 'is-admin'],
|
|
'users/show': 'is-authenticated',
|
|
'users/update': 'is-authenticated',
|
|
'users/update-email': 'is-authenticated',
|
|
'users/update-password': 'is-authenticated',
|
|
'users/update-username': 'is-authenticated',
|
|
'users/update-avatar': 'is-authenticated',
|
|
'users/create-api-key': ['is-authenticated', 'is-admin'],
|
|
'users/setup-totp': 'is-authenticated',
|
|
'users/enable-totp': 'is-authenticated',
|
|
'users/disable-totp': 'is-authenticated',
|
|
'users/regenerate-totp-recovery-codes': 'is-authenticated',
|
|
'users/index-trusted-devices': 'is-authenticated',
|
|
'users/delete-trusted-device': 'is-authenticated',
|
|
'users/delete': ['is-authenticated', 'is-admin'],
|
|
|
|
'projects/create': ['is-authenticated', 'is-external', 'is-admin-or-project-owner'],
|
|
|
|
'_internal/update-config': ['is-authenticated', 'is-internal'],
|
|
|
|
index: true,
|
|
'swagger/show': true,
|
|
'bootstrap/show': true,
|
|
'terms/show': true,
|
|
'access-tokens/create': true,
|
|
'access-tokens/verify-totp': true,
|
|
'access-tokens/accept-terms': true,
|
|
'access-tokens/revoke-pending-token': true,
|
|
};
|