本文整理匯總了TypeScript中idam/authorizationMiddleware.AuthorizationMiddleware類的典型用法代碼示例。如果您正苦於以下問題:TypeScript AuthorizationMiddleware類的具體用法?TypeScript AuthorizationMiddleware怎麽用?TypeScript AuthorizationMiddleware使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了AuthorizationMiddleware類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: requestHandler
function requestHandler (): express.RequestHandler {
function accessDeniedCallback (req: express.Request, res: express.Response): void {
res.redirect(OAuthHelper.forLogin(req, res))
}
const requiredRoles = ['citizen']
const unprotectedPaths = []
return AuthorizationMiddleware.requestHandler(requiredRoles, accessDeniedCallback, unprotectedPaths)
}
示例2: defendantFirstContactRequestHandler
function defendantFirstContactRequestHandler (): express.RequestHandler {
function accessDeniedCallback (req: express.Request, res: express.Response): void {
res.redirect(Paths.startPage.uri)
}
// IDAM doesn't set cmc-private-beta yet so we don't check for it
const requiredRoles = [
'letter-holder'
]
const unprotectedPaths = [
Paths.startPage.uri,
Paths.claimReferencePage.uri,
ErrorPaths.claimSummaryAccessDeniedPage.uri
]
return AuthorizationMiddleware.requestHandler(requiredRoles, accessDeniedCallback, unprotectedPaths)
}