Comments (12)
Aquí hay un enlace a la implementación predeterminada de la interfaz IAuthUI
Tiene una aplicación WinForms, por lo que se supone que la implementación del método GetUserCredentials (credenciales IUserCredentials) debe mostrar un formulario con campos de entrada de nombre de usuario y contraseña. El parámetro "credenciales", si no es nulo, puede contener la última información de usuario registrada.
Se supone que el método GetTwoFactorCode muestra un formulario que le pide al usuario que ingrese el código de autorización de Second Factor
from commander.
from commander.
De hecho, la biblioteca de la derecha declara que los métodos.
Su código a la izquierda necesita proporcionar implementación para estos métodos. Mostrar formulario de inicio de sesión de nombre de usuario / contraseña para el método "GetUserCredentials"
y formulario de código 2FA para "GetTwoFactorCode"
from commander.
private TaskCompletionSource<IUserCredentials> _credentials;
public Task<IUserCredentials> GetUserCredentials(IUserCredentials credentials)
{
// Show Login form
_credentials = new TaskCompletionSource<IUserCredentials>();
return _credentials.Task;
}
void SubmitLoginForm() {
var cred = new UserCredencials
{
Username = "username",
Password = "password"
};
_credentials.SetResult(cred);
}
from commander.
void CancelLoginForm() { _credentials.SetCanceled(); }
from commander.
Disculpame pero creo que es algo de los archivos DLL que se incluyen ya compilados.
Tengo el mismo codigo y dos librerias diferentes.
Esta libreria no tiene ese metodo implementado y falla en windows form
Commander-master\dotnet-keeper-sdk\KeeperSdk\bin\Debug\net45\KeeperSdk.dll
Esta libreria si que tiene ese metodo implemenado y funciona
Commander-master\dotnet-keeper-sdk\KeeperSdk\obj\Debug\netstandard2.0\KeeperSdk.dll
¿Podeis hacer el ejemplo de Commander con un WindowsForm? Por ejemplo un richtextbox para la consola y un textbox para introducir comandos?
from commander.
Se espera que el proyecto KeeperSdk construya tres DLL para tres objetivos .NET (.NET Framework, .Net Standard y .NET Core). Su proyecto utiliza el objetivo correcto. Puedo ver Debug \ net45 \ KeeperSdk.dll en la esquina inferior derecha de las capturas de pantalla. No creo que haya una aplicación de ejemplo de Commander para WinForms.
from commander.
Al final he simplificado mucho lo que queria y ha funcionado leyendo un caso cerrado de otro usuario y adaptandolo. Commander es mucho mas rapido en c# en responder que en python.
JsonConfigurationStorage storage = new JsonConfigurationStorage();
KeeperEndpoint ke = new KeeperEndpoint(storage);
AuthContext Auth = new AuthContext(ke, null);
//Initialize user configuration and set the login credentials.
UserConfiguration keeperLogin = new UserConfiguration();
keeperLogin.Username = "username";
keeperLogin.Password = "pass";
//Login to keeper
await Auth.Login(keeperLogin);
//Access the vault and sync down the data from the vault
Vault vault = new Vault(Auth);
await SyncDownExtension.SyncDown(vault);
PasswordRecord record = new PasswordRecord();
vault.TryGetRecord("xxxxxxx", out record);
MessageBox.Show( record.Password);
from commander.
This code works until the "Login" flow requires some user input.
For instance, provide 2FA code.
The following line of code, the null
part of it
AuthContext Auth = new AuthContext(ke, null);
makes "login" flow fail if customer's account requires second factor authentication
I would not do that. I would support at least 2FA flow in the class implementing IAuthUI interface.
It is GetTwoFactorCode
method. Any other methods may return default value or throw exception.
The implementation of GetTwoFactorCode
method is quite simple for the WinForms application:
private TaskCompletionSource<string> _secondFactorTask;
public Task<string> GetTwoFactorCode()
{
_secondFactorTask = new TaskCompletionSource<string>();
//TODO Show "Enter 2FA Code" form
return _secondFactorTask.Task;
}
// When customer clicks "OK" button on
void Submit2FACodeButtonClicked(string code) {
_secondFactorTask.SetResult(code);
}
from commander.
from commander.
Existe algo parecido a vault.dispose() ?
Tengo unos 500 registros y consume memoria, pasa de 20MB a 45MB en RAM despues de descargar la informacion. me gustaria una vez obtenido el password del registro que necesito, vaciar la memoria y seguir la ejecucion del prgrama.
from commander.
No, there is not need for Dispose. Just auth.Logout();
and set vault=null;
. Memory will be released with the next garbage collector cycle
from commander.
Related Issues (20)
- Using CLI in shell scripts HOT 5
- Bug: Keeper accepts broken data from RecordEditCommand.execute() which breaks future record access HOT 3
- Missing example config.json for python auth HOT 2
- recordv3.RecordAddCommand can't add OTP code HOT 1
- `compliance team-report` empty columns: number of records & shared folder names HOT 4
- Bug: the CLI allow view data after session expired HOT 1
- Aging-report results are incorrect HOT 5
- Allow MariaDB rotation with MySQL plugin HOT 1
- `get` command to only print specified field HOT 6
- Subcommand to verify login status HOT 6
- XDG Compliance HOT 2
- Keeper Commander pip3 fails to install on Windows ARM64 - "Unable to find vcvarsall.bat" HOT 6
- ssh-agent doesn't work correctly unless run from shell HOT 2
- No module named 'keepercommander.importer.proton' HOT 2
- "Failed to paste from clipboard" on login with Windows 10 22H2 / WSL2 / Ubuntu 22.04 HOT 3
- Request: Add TouchID support or link with native app HOT 2
- missing --legacy option HOT 2
- :bug: search defaults to verbose, `--verbose` switch has no affect. HOT 1
- :sparkles: Add ability to pipe commands
- Use Commander modules in Python script HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commander.