api-service-core
Version:
NodeJS api-service
41 lines (40 loc) • 1.65 kB
TypeScript
/*************************************************************************
*
* Troven CONFIDENTIAL
* __________________
*
* (c) 2017-2019 Troven Pty Ltd
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Troven Pty Ltd and its licensors,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Troven Pty Ltd
* and its suppliers and may be covered by International and Regional Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Troven Pty Ltd.
*/
import { IChassisContext, IOperation, IChassisMiddleware } from "../index";
import { Request, Response } from "express";
import JWTPlugin from "../plugins/jwt";
/**
* Authenticate JWT
* ----------------
* Ensures a JWT is correctly formed and signed by the trusted KeycloakIdP.
*
* Loads the server public certificate from file or URL.
*
* Can enforce mandatory claims for all resources.
*
* @type {{name: string, title: string, description: string, usecase: [string], _loadPublicKey: module.exports._loadPublicKey, fn: module.exports.fn}}
*/
export default class jwt_authenticate implements IChassisMiddleware {
protected plugin: JWTPlugin;
name: string;
title: string;
constructor(plugin: JWTPlugin);
fn(operation: IOperation, _options: any): Function;
static authenticate(context: IChassisContext, op: IOperation, req: Request, res: Response, secretOrCertificate?: string): boolean;
}