當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。