Skip to content

Why doesn't AddCors or AddJwtBearer have support for getting a registered DI/IoC item? #57750

Answered by pinkfloydx33
PureKrome asked this question in Q&A
Discussion options

You must be logged in to vote

Those are just the initial setting values, you can still configure the values after the calls to AddCors/AddJwtBearer but before the service provider is built. Just register IConfigureOptions<CorsOptions> or IConfigureOptions<JwtBearerOptions> and inject your configuration dependencies into those. You can then use Configure (or PostConfigure with IPostConfigureOptions<>) to complete the configuration using your dynamic values

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by davidfowl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants