jwt gen & rename fixes
This commit is contained in:
parent
313785b4ac
commit
a165231c47
13 changed files with 101 additions and 41 deletions
|
@ -74,14 +74,16 @@ export async function getWebapiPermissions(req: Request, res: Response): Promise
|
|||
*/
|
||||
export async function createWebapi(req: Request, res: Response): Promise<any> {
|
||||
let title = req.body.title;
|
||||
let expiry = req.body.expiry;
|
||||
let expiry = req.body.expiry || null;
|
||||
|
||||
let token = await JWTHelper.create({
|
||||
iss: CLUB_NAME,
|
||||
sub: "api_token_retrieve",
|
||||
iat: new Date().toISOString(),
|
||||
aud: StringHelper.random(32),
|
||||
});
|
||||
let token = await JWTHelper.create(
|
||||
{
|
||||
iss: CLUB_NAME,
|
||||
sub: "api_token_retrieve",
|
||||
aud: StringHelper.random(32),
|
||||
},
|
||||
{ useExpiration: false }
|
||||
);
|
||||
|
||||
let createApi: CreateWebapiCommand = {
|
||||
token: token,
|
||||
|
@ -102,7 +104,7 @@ export async function createWebapi(req: Request, res: Response): Promise<any> {
|
|||
export async function updateWebapi(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let title = req.body.title;
|
||||
let expiry = req.body.expiry;
|
||||
let expiry = req.body.expiry || null;
|
||||
|
||||
let updateApi: UpdateWebapiCommand = {
|
||||
id: id,
|
||||
|
@ -127,7 +129,7 @@ export async function updateWebapiPermissions(req: Request, res: Response): Prom
|
|||
let permissionStrings = PermissionHelper.convertToStringArray(permissions);
|
||||
|
||||
let updateApiPermissions: UpdateWebapiPermissionsCommand = {
|
||||
apiId: id,
|
||||
webapiId: id,
|
||||
permissions: permissionStrings,
|
||||
};
|
||||
await WebapiPermissionCommandHandler.updatePermissions(updateApiPermissions);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue