Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Refactor DI support in DataProtection #134

Closed
ajaybhargavb opened this issue Mar 24, 2016 · 10 comments
Closed

Refactor DI support in DataProtection #134

ajaybhargavb opened this issue Mar 24, 2016 · 10 comments
Assignees

Comments

@ajaybhargavb
Copy link
Contributor

No description provided.

@muratg
Copy link

muratg commented Apr 5, 2016

@ajaybhargavb How close is this for check-in?

@Eilon Are we taking this in RC2? Or postpone to 1.0.0?

@ajaybhargavb
Copy link
Contributor Author

I'll be sending an update to the PR today. But it will not include and test and documentation changes.

@Eilon
Copy link
Member

Eilon commented Apr 6, 2016

I'd like to get this for RC2 because there are public API changes in it, and I spoke to @ajaybhargavb about it and we had a short email thread too.

@muratg
Copy link

muratg commented Apr 21, 2016

Looks like the PR is a little stale at the moment. Do we have any blockers on this?

@ajaybhargavb
Copy link
Contributor Author

Spoke to @Eilon and @rynowak this morning. This is being moved to RTM.

@ajaybhargavb
Copy link
Contributor Author

The latest code and samples are in https://github.com/aspnet/DataProtection/tree/ajbaaska/new-dataprotection branch.

@guardrex
Copy link

@ajaybhargavb You're working on the DI bits, right? I ask because I was having a small problem with DI into the XmlDecryptor. #154

The problem was that DI for XmlDecryptor wasn't working. I wanted to do this ...

public CustomXmlDecryptor(IOptions<CustomDataProtectionOptions> dataProtectionOptions)
{
    _key = dataProtectionOptions.Value.Key;
}

... but that wasn't working. I simply wasn't getting the value. It works using the ctor injection pattern for XmlEncryptor, just not for XmlDecryptor.

With a little help from @tillig, I was able to make it work on the decryptor side with a little hack, I ended up having to do this ...

public CustomXmlDecryptor(IServiceProvider services)
{
    var dataProtectionOptions = 
        services.GetRequiredService<IOptions<CustomDataProtectionOptions>>();
    _key = dataProtectionOptions.Value.Key;
}

Is fixing this something that falls under this issue, or was this problem already addressed do you know?

@rynowak
Copy link
Member

rynowak commented Oct 26, 2016

@guardrex - please make a separate issue for this. Having looked at the code, this isn't something that's been supported so far so it's a feature request

@guardrex
Copy link

@rynowak Ok, thanks. Will do.

@guardrex
Copy link

I reopened and re-titled that issue ... it basically describes the difference in success using DI with the ctors of IXmlDecryptor and IXmlEncryptor. Given the workaround there, I'm not blocked of course, so it really is just a nice-to-have if you like the idea.

#154

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants