Conversation
984f30a to
a91b6fb
Compare
|
@sduenas Changes for dealing with credentials with same format of perceval are up. |
sduenas
left a comment
There was a problem hiding this comment.
I think it would make more sense if this code is part of the credentials manager of each provider/service. I think how to access to the credentials/fields should be encapsulated on each provider's class. The behavior is different for each manager, so I think the access should be transparent for the client.
You can create an abstract class that BitwardenManager and HashicorpManager need to implement, now that we know what similarities they have. The resolve_credentials function duplicates code for both managers. I think you can make it more generic if needed, by including the specific code of each manager in a method classes have to implement, and that resolve_credentials will call.
Also, I don't think we need a factory because we only have two different classes.
Add CredentialManager ABC with a resolve_credentials() Template Method that orchestrates login, secret fetching, field extraction, and logout in a single call. This allows any caller (BackendCommand, KingArthur, scripts) to resolve secrets without depending on Perceval's CLI layer. - Add CredentialManager ABC as base class for credential managers - Add resolve_credentials() with field extraction loop and login/logout lifecycle management - Fix BitwardenManager logout to clean up temporary appdata directory - Document usage in README Signed-off-by: Alberto Ferrer Sánchez <alberefe@gmail.com>
a91b6fb to
1bbb0bf
Compare
|
Hi. I say I've tried cause not sure if it's what you meant. It does work by itself, tests pass and it works with perceval. Also works as standalone library and does not need cli to work. Removed the factory, left the ABC CredentialManager. Tell me your thoughts! Also, i added a temp file creation by bw_manager and modified the logout cause sometimes the previous stale session would give problems, so solved it with this using info from the docs of Bitwarden CLI on how to run parallel sessions of the tool. |
Add CredentialManager ABC with a resolve_credentials() Template Method
that orchestrates login, secret fetching, field extraction, and logout
in a single call. This allows any caller (BackendCommand, KingArthur,
scripts) to resolve secrets without depending on Perceval's CLI layer.
lifecycle management