简体   繁体   中英

Customize . well-known configurations in npm oidc-provider library

I am using npm package panva's oidc-provider to implement features of OIDC for login.

I want to override a few well known configurations of OIDC provider.

Well known configuration url:

<EXTERNAL DNS OF AUTH SERVER>/.well-known/openid-configuration

For example: I want to override the <EXTERNAL DNS OF AUTH SERVER>/token end point to <INTERNAL DNS OF AUTH SERVER>/token

Is any such feature given by the library?

Can anyone help me please?

We can use middlewares. You control the complete response in the post-middleware, so change it to whatever you need, whenever you need.

https://github.com/panva/node-oidc-provider/blob/main/docs/README.md#pre--and-post-middlewares

If you need to customize the node-oidc-provider.well-known configuration url, the best way is:

  • update default params as you need
  • Use the discovery field of the configuration to add custom field
/** Hold all the OIDC Provider configurations */
module.exports = {

    /** https://github.com/panva/node-oidc-provider/tree/main/docs#discovery */
    discovery: discovery,

    /** @See https://github.com/panva/node-oidc-provider/tree/main/docs#findaccount */
    findAccount: Account.findAccount,

    /** @See https://github.com/panva/node-oidc-provider/tree/main/docs#clients  */
    clients: clients,

// Others configurations
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM