当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript callbackBuilder.buildURL函数代码示例

本文整理汇总了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}`
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:7,代码来源:oAuthHelper.ts

示例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}`
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:7,代码来源:oAuthHelper.ts

示例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}`
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:9,代码来源:oAuthHelper.ts

示例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)
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:10,代码来源:callbackBuilder.ts

示例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()
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:17,代码来源:receiver.ts

示例6: expect

 expect(() => buildURL(req, undefined)).to.throw(Error, 'Path null or undefined')
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:1,代码来源:callbackBuilder.ts

示例7: buildURL

const getReturnURL = (req: express.Request, externalId: string) => {
  return buildURL(req, Paths.finishPaymentReceiver.evaluateUri({ externalId: externalId }))
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:3,代码来源:pay.ts


注:本文中的utils/callbackBuilder.buildURL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。