const auth_routes = { prefix: '/api/v1/auth', middleware: [ ], get: { '/mfa/enable/date': ['middleware::auth:UserOnly', 'controller::api:v1:Auth.get_mfa_enable_date'], '/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', ], '/roles': [ 'middleware::auth:APIRoute', ['middleware::api:Permission', { check: 'v1:auth:roles:list' }], 'controller::api:v1:Auth.get_roles', ], '/users': [ 'middleware::auth:APIRoute', ['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', ], '/users/:id/photo': [ 'controller::api:v1:Auth.get_user_photo', ], '/groups/:id': [ 'middleware::auth:APIRoute', ['middleware::api:Permission', { check: 'v1:auth:groups:get' }], 'controller::api:v1:Auth.get_group', ], '/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' ], '/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' ], '/mfa/recovery/attempt': [ 'middleware::auth:UserOnly', 'controller::api:v1:Auth.attempt_mfa_recovery' ], '/mfa/enable': [ 'middleware::auth:UserOnly', ['middleware::auth:RequireTrust', { scope: 'mfa.enable', deplete: true }], 'controller::api:v1:Auth.enable_mfa' ], '/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', ], '/registration': [ ['middleware::util:Setting', { key: 'auth.allow_registration' }], 'middleware::auth:GuestOnly', 'controller::api:v1:Auth.registration', ], '/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