You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are building a custom authentication scheme that doesn't need data protection, there is currently no way to add authentication without adding data protection services. This means that at startup, keys are generated and logging is created (if they aren't persisted or encrypted) - when it's completely unnecessary.
This is because inside Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions the code looks like this:
The call to AddDataProtection is added indiscriminately. From a developers point of view this can be worked around by replicating this code and the call to AddDataProtection() is removed:
But I expect this code to break in the future as it's not documented or supported.
As a possible solution maybe a new boolean property named RequiresDataProtection that defaults to true could be added to the AuthenticationOptions class, and if set to false, Data Protection is not added?
Describe the solution you'd like
A new boolean property on the AuthenticationOptions class that can optionally exclude the AddDataProtection API call.
Additional context
I'm running a simple stateless web api in an AWS Lambda function. As it stands, this results in a bunch of warning log messages occuring on every startup. Ideally this overhead doesn't take place at all, as I do not have the need for the DataProtection APIs.
The text was updated successfully, but these errors were encountered:
Auth isn't the only component that requires data protection, it's also used by session, anti-forgery, and other components. Rather than tweaking each of these components to avoid adding the service, how about configuring data protection itself to turn off?
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I'd like to revisit this issue: #33779
If you are building a custom authentication scheme that doesn't need data protection, there is currently no way to add authentication without adding data protection services. This means that at startup, keys are generated and logging is created (if they aren't persisted or encrypted) - when it's completely unnecessary.
This is because inside Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions the code looks like this:
The call to AddDataProtection is added indiscriminately. From a developers point of view this can be worked around by replicating this code and the call to AddDataProtection() is removed:
But I expect this code to break in the future as it's not documented or supported.
As a possible solution maybe a new boolean property named RequiresDataProtection that defaults to true could be added to the AuthenticationOptions class, and if set to false, Data Protection is not added?
Describe the solution you'd like
A new boolean property on the AuthenticationOptions class that can optionally exclude the AddDataProtection API call.
Additional context
I'm running a simple stateless web api in an AWS Lambda function. As it stands, this results in a bunch of warning log messages occuring on every startup. Ideally this overhead doesn't take place at all, as I do not have the need for the DataProtection APIs.
The text was updated successfully, but these errors were encountered: