mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 02:47:35 +00:00
Add frontend, backend and CLI
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import express from 'express';
|
||||
const router = express.Router();
|
||||
import {
|
||||
requireAuth,
|
||||
requireWorkspaceAuth,
|
||||
requireServiceTokenAuth,
|
||||
validateRequest
|
||||
} from '../middleware';
|
||||
import { body } from 'express-validator';
|
||||
import { ADMIN, MEMBER, GRANTED } from '../variables';
|
||||
import { serviceTokenController } from '../controllers';
|
||||
|
||||
// TODO: revoke service token
|
||||
|
||||
router.get(
|
||||
'/',
|
||||
requireServiceTokenAuth,
|
||||
serviceTokenController.getServiceToken
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
requireAuth,
|
||||
requireWorkspaceAuth({
|
||||
acceptedRoles: [ADMIN, MEMBER],
|
||||
acceptedStatuses: [GRANTED],
|
||||
location: 'body'
|
||||
}),
|
||||
body('name').exists().trim().notEmpty(),
|
||||
body('workspaceId').exists().trim().notEmpty(),
|
||||
body('environment').exists().trim().notEmpty(),
|
||||
body('expiresIn'), // measured in ms
|
||||
body('publicKey').exists().trim().notEmpty(),
|
||||
body('encryptedKey').exists().trim().notEmpty(),
|
||||
body('nonce').exists().trim().notEmpty(),
|
||||
validateRequest,
|
||||
serviceTokenController.createServiceToken
|
||||
);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user