auth

Main authentication module for my projects
git clone git://git.finwo.net/app/auth
Log | Files | Refs

me.js (486B)


      1 import { app } from '../../../app.js';
      2 import { authenticateAdminSession } from '../../../lib/admin-auth.js';
      3 import { getAdminCurrentUser } from '../../../lib/admin-users.js';
      4 
      5 export default {
      6   method: 'get',
      7   path: '/api/v1/admin/me',
      8   name: 'admin.me',
      9   async handler(req) {
     10     const auth = await authenticateAdminSession(req);
     11     const user = await getAdminCurrentUser(auth.systemDb, auth.user);
     12 
     13     return new app.HttpOk({ user }, { 'cache-control': 'no-store' });
     14   },
     15 };