本文整理汇总了TypeScript中utils/callbackBuilder.buildURL函数的典型用法代码示例。如果您正苦于以下问题:TypeScript buildURL函数的具体用法?TypeScript buildURL怎么用?TypeScript buildURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buildURL函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: forUplift
static forUplift (req: express.Request, res: express.Response): string {
const redirectUri = buildURL(req, Paths.receiver.uri)
const user: User = res.locals.user
OAuthHelper.storeStateCookie(req, res, user.id)
return `${loginPath}/uplift?response_type=code&state=${user.id}&client_id=${clientId}&redirect_uri=${redirectUri}`
}
示例2: forPin
static forPin (req: express.Request, res: express.Response, claimReference: string): string {
const redirectUri = buildURL(req, Paths.receiver.uri)
const state = claimReference
OAuthHelper.storeStateCookie(req, res, state)
return `${loginPath}/pin?response_type=code&state=${state}&client_id=${clientId}&redirect_uri=${redirectUri}`
}
示例3: forLogin
static forLogin (req: express.Request,
res: express.Response,
receiver: RoutablePath = Paths.receiver): string {
const redirectUri = buildURL(req, receiver.uri)
const state = uuid()
OAuthHelper.storeStateCookie(req, res, state)
return `${loginPath}?response_type=code&state=${state}&client_id=${clientId}&redirect_uri=${redirectUri}`
}
示例4: it
it('for SSL request ', () => {
const path = 'my/service/path'
const expected = `https://localhost/${path}`
req.secure = true
req.headers = { host: 'localhost' }
let url = buildURL(req, path)
expect(url.length).gt(0)
expect(url).to.eq(expected)
})
示例5: getOAuthAccessToken
async function getOAuthAccessToken (req: express.Request, receiver: RoutablePath): Promise<string> {
if (req.query.state !== OAuthHelper.getStateCookie(req)) {
trackCustomEvent('State cookie mismatch (citizen)',
{
requestValue: req.query.state,
cookieValue: OAuthHelper.getStateCookie(req)
})
}
const authToken: AuthToken = await IdamClient.exchangeCode(
req.query.code,
buildURL(req, receiver.uri)
)
if (authToken) {
return authToken.accessToken
}
return Promise.reject()
}
示例6: expect
expect(() => buildURL(req, undefined)).to.throw(Error, 'Path null or undefined')
示例7: buildURL
const getReturnURL = (req: express.Request, externalId: string) => {
return buildURL(req, Paths.finishPaymentReceiver.evaluateUri({ externalId: externalId }))
}