cyberark / conjur-api-dotnet

.NET client for the CyberArk Conjur API
Apache License 2.0
15 stars 11 forks source link

Acting as as a parameter #11

Closed sashaCher closed 6 years ago

sashaCher commented 6 years ago

ActingAs property has a branch of problem

sashaCher commented 6 years ago

@dividedmind

  1. According to this https://conjur.docs.apiary.io/ reference there are only 8 API those accept acting_as parameter. All those APIs accept the parameter as a part of query section of URL. Is this behavior the same for all APIs mentioned in reference? Where I can find more detailed version of Conjur v4 REST API reference?

  2. For implementing it according to your proposal we need to do one those things:

In current implementation not Client nor ApiKeyAuthenticator will have never collected by GC because Timer object holds them from inside. In some use cases it may lead to memory leak.

dividedmind commented 6 years ago
  1. I'm not sure, frankly I just checked the source and acting_as is handled on the application level :) I guess it's only really useful for some calls and that's why it's documented like that.
  2. Ah, you're right about the leak, good catch! Another solution for it would be to have the timer hold a weak reference to the authenticator. However I'm pretty sure the Client would still get GCed; the authenticator doesn't hold any reference to it (that I can see, please correct me if I'm wrong). Since the authenticator is shared between the instances the leak is therefore limited and happens independently of how ActingAs is implemented — in particular to the same extent with the current code.