Ejemplo n.º 1
0
        public async Task <AppyOnePasswordSession> GetCurrent()
        {
            var session = await _environmentSessionStorage.GetCurrent();

            if (!_platformInfo.IsRunningOnWindows() && string.IsNullOrWhiteSpace(session.Organization))
            {
                session = await _fileSessionStorage.GetCurrent();
            }

            return(session);
        }
        public Task <AppyOnePasswordSession> GetCurrent()
        {
            if (_platformInfo.IsRunningOnWindows())
            {
                return(Task.FromResult(AppyOnePasswordSession.New(
                                           organization: _envAccessor.GetUserEnvironmentVariable(KnownSessionVars.OnePasswordOrganization),
                                           environment: _envAccessor.GetUserEnvironmentVariable(KnownSessionVars.OnePasswordEnvironment),
                                           sessionToken: _envAccessor.GetUserEnvironmentVariable(KnownSessionVars.OnePasswordSessionToken),
                                           vault: _envAccessor.GetUserEnvironmentVariable(KnownSessionVars.OnePasswordVault)
                                           )));
            }

            return(Task.FromResult(AppyOnePasswordSession.New(
                                       organization: _envAccessor.GetProcessEnvironmentVariable(KnownSessionVars.OnePasswordOrganization),
                                       environment: _envAccessor.GetProcessEnvironmentVariable(KnownSessionVars.OnePasswordEnvironment),
                                       sessionToken: _envAccessor.GetProcessEnvironmentVariable(KnownSessionVars.OnePasswordSessionToken),
                                       vault: _envAccessor.GetProcessEnvironmentVariable(KnownSessionVars.OnePasswordVault)
                                       )));
        }