Is there a way to modify/add/remove authentication schemes while server is running?
(need to add scheme without restarting my server)
CodePudding user response:
The key for adding new scheme resides withing the IOptionsFactory<TOptions>
object.
While you may configure multiple IAuthenticationHandler
's of same type the authenticationScheme
fields specifies each's configuration (in sourcecode it is refered as TOptions
).
As all runtime options are configured and "sealed" at startup (see:
After adding oidc2
scheme programatically - oidc2
can access identity provider
CodePudding user response:
If you want change the code which is running in your server, it's impossible to modify authentication schemes
.
Unless you use Azure webapp, you can create a slot to hot start your application.
Suggestion:
You need change your code, and rebuild your project, and you must retsart your webapp. You can think about how to add authentication schemes dynamically.
This repo should be useful to you. For more details, you can refer below post.