首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用ExpressJS在mountPath上挂载node提供程序?

如何使用ExpressJS在mountPath上挂载node提供程序?
EN

Stack Overflow用户
提问于 2020-09-05 06:34:44
回答 1查看 495关注 0票数 0

我正在使用node-oidc-provider (v6.29.3)库构建一个简单的OIDC Connect模拟服务,但是在尝试将提供程序挂载到特定的mountPath上时遇到了问题。如果挂载到/上,一切都可以正常工作,但是尝试挂载到/oidc上是行不通的,因为node-oidc-provider的内部结构忽略了mountPath

我的设置大致如下:

代码语言:javascript
复制
const path = require('path')
const express = require('express')
const { Provider } = require('oidc-provider')

const configuration = require('src/utils/oidc')
const Account = require('src/account')

configuration.findAccount = Account.findAccount
const app = express()

app.set('views', path.join(__dirname, '..', 'views'))
app.set('view engine', 'ejs')

const mountPath = '/oidc'
const issuer = 'http://localhost:3000' + mountPath

const provider = new Provider(issuer, configuration)
app.use(mountPath, provider.callback)

app.listen(3000).then(() => {
  console.log('started')
})

我可以连接到http://localhost:3000/oidc/.well-known/openid-configuration并接收

代码语言:javascript
复制
{
  "authorization_endpoint":"http://localhost:3000/oidc/auth",
  "device_authorization_endpoint":"http://localhost:3000/oidc/device/auth",
  "claims_parameter_supported":false,
  "claims_supported":[
    "sub",
    "email",
    "givenName",
    "surname",
    "memberOf",
    "publishers",
    "sid",
    "auth_time",
    "iss"
  ],
  "code_challenge_methods_supported":["S256"],
  "end_session_endpoint":"http://localhost:3000/oidc/session/end",
  "grant_types_supported":[
    "implicit","authorization_code",
    "refresh_token",
    "urn:ietf:params:oauth:grant-type:device_code"
  ],
  "id_token_signing_alg_values_supported":["HS256", "PS256", "RS256", "ES256"],
  "issuer":"http://localhost:3000/oidc",
  "jwks_uri":"http://localhost:3000/oidc/jwks",
  "response_modes_supported":["form_post","fragment","query"],
  "response_types_supported":["code id_token","code","id_token","none"],
  "scopes_supported":["openid","offline_access","email","profile"],
  "subject_types_supported":["public"],
  "token_endpoint_auth_methods_supported":[
    "none",
    "client_secret_basic",
    "client_secret_jwt",
    "client_secret_post",
    "private_key_jwt"
  ],
  "token_endpoint_auth_signing_alg_values_supported":["HS256", "RS256", "PS256", "ES256", "EdDSA"],
  "token_endpoint":"http://localhost:3000/oidc/token",
  "request_object_signing_alg_values_supported":["HS256", "RS256", "PS256", "ES256", "EdDSA"],
  "request_parameter_supported":false,
  "request_uri_parameter_supported":true,
  "require_request_uri_registration":true,
  "userinfo_endpoint":"http://localhost:3000/oidc/me",
  "userinfo_signing_alg_values_supported":["HS256","PS256","RS256","ES256"],
  "introspection_endpoint":"http://localhost:3000/oidc/token/introspection",
  "introspection_endpoint_auth_methods_supported":[
    "none",
    "client_secret_basic",
    "client_secret_jwt",
    "client_secret_post",
    "private_key_jwt"
  ],
  "introspection_endpoint_auth_signing_alg_values_supported":["HS256", "RS256", "PS256", "ES256", "EdDSA"],
  "revocation_endpoint":"http://localhost:3000/oidc/token/revocation",
  "revocation_endpoint_auth_methods_supported":[
    "none",
    "client_secret_basic",
    "client_secret_jwt",
    "client_secret_post",
    "private_key_jwt"
  ],
  "revocation_endpoint_auth_signing_alg_values_supported":["HS256", "RS256", "PS256", "ES256", "EdDSA"],
  "claim_types_supported":["normal"]
}

使用一个简单的测试所有我登录和我的日志显示(正确)

代码语言:javascript
复制
GET /oidc/auth

但是,在内部,它会重定向到:

代码语言:javascript
复制
GET /interaction/znBzRfhyoBTCg1cFcLult

我需要内部重定向转到

代码语言:javascript
复制
GET /oidc/interaction/znBzRfhyoBTCg1cFcLult

如何告诉OIDC提供者通过给定的mountPath而不是/进行重定向

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-01 00:52:19

您必须配置interactions.url帮助器。有关更多详细信息,请参阅documentation

稍后,您将必须构建自己的最终用户交互,并且无论如何都必须配置此帮助程序。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63748722

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档