CoreID/app/routing/routers/api/v1/auth.routes.js

147 lines
4.6 KiB
JavaScript
Raw Normal View History

const auth_routes = {
prefix: '/api/v1/auth',
middleware: [
],
get: {
2020-05-04 01:16:54 +00:00
'/mfa/enable/date': ['middleware::auth:UserOnly', 'controller::api:v1:Auth.get_mfa_enable_date'],
2020-05-12 01:26:09 +00:00
'/traps': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:traps:list'}],
'controller::api:v1:Auth.get_traps',
],
'/authenticated_user': [
'controller::api:v1:Auth.get_auth_user',
],
2020-05-12 01:26:09 +00:00
'/roles': [
'middleware::auth:APIRoute',
2020-05-12 01:26:09 +00:00
['middleware::api:Permission', { check: 'v1:auth:roles:list' }],
'controller::api:v1:Auth.get_roles',
],
'/users': [
'middleware::auth:APIRoute',
2020-05-12 01:26:09 +00:00
['middleware::api:Permission', { check: 'v1:auth:users:list' }],
'controller::api:v1:Auth.get_users',
],
'/groups': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:groups:list' }],
'controller::api:v1:Auth.get_groups',
],
'/users/:id': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:users:get' }],
'controller::api:v1:Auth.get_user',
],
'/groups/:id': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:groups:get' }],
'controller::api:v1:Auth.get_group',
],
2020-05-30 22:21:47 +00:00
'/mfa/recovery': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:mfa:recovery:get' }],
'controller::api:v1:Auth.get_mfa_recovery',
],
},
post: {
'/validate/username': [
'controller::api:v1:Auth.validate_username'
],
2020-05-20 14:56:03 +00:00
'/validate/user_exists': [
'controller::api:v1:Auth.user_exists',
],
'/validate/email': [
'controller::api:v1:Auth.validate_email',
],
'/attempt': [
'controller::api:v1:Auth.attempt'
],
'/mfa/generate': [
'middleware::auth:UserOnly',
'controller::api:v1:Auth.generate_mfa_key'
],
'/mfa/attempt': [
'middleware::auth:UserOnly',
'controller::api:v1:Auth.attempt_mfa'
],
2020-05-30 22:21:47 +00:00
'/mfa/recovery/attempt': [
'middleware::auth:UserOnly',
'controller::api:v1:Auth.attempt_mfa_recovery'
],
2020-05-04 01:16:54 +00:00
'/mfa/enable': [
'middleware::auth:UserOnly',
['middleware::auth:RequireTrust', { scope: 'mfa.enable', deplete: true }],
'controller::api:v1:Auth.enable_mfa'
],
2020-05-04 01:16:54 +00:00
'/mfa/disable': [
'middleware::auth:UserOnly',
['middleware::auth:RequireTrust', { scope: 'mfa.disable', deplete: true }],
'controller::api:v1:Auth.disable_mfa',
],
'/groups': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:groups:create' }],
'controller::api:v1:Auth.create_group',
],
'/users': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:users:create' }],
'controller::api:v1:Auth.create_user',
],
2020-05-20 14:56:03 +00:00
'/registration': [
['middleware::util:Setting', { key: 'auth.allow_registration' }],
'middleware::auth:GuestOnly',
'controller::api:v1:Auth.registration',
],
2020-05-30 22:21:47 +00:00
'/mfa/recovery': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:mfa:recovery:create' }],
'controller::api:v1:Auth.generate_mfa_recovery',
],
},
patch: {
'/groups/:id': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:groups:update' }],
'controller::api:v1:Auth.update_group',
],
'/users/:id': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:users:update' }],
'controller::api:v1:Auth.update_user',
],
},
delete: {
'/groups/:id': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:groups:delete' }],
'controller::api:v1:Auth.delete_group',
],
'/users/:id': [
'middleware::auth:APIRoute',
['middleware::api:Permission', { check: 'v1:auth:users:delete' }],
'controller::api:v1:Auth.delete_user',
],
},
}
module.exports = exports = auth_routes