Esempio n. 1
0
        private async Task UsernamePasswordAuthenticationProviderTests()
        {
            // userpass auth

            var path     = "userpass" + Guid.NewGuid();
            var prefix   = "auth/" + path;
            var username = "******";
            var password = "******";

            var authenticationInfo = new UsernamePasswordAuthenticationInfo(path, username, password);

            var userPassClient = VaultClientFactory.CreateVaultClient(_vaultUri, authenticationInfo);
            var authBackend    = new AuthenticationBackend {
                BackendType = AuthenticationBackendType.UsernamePassword, AuthenticationPath = authenticationInfo.MountPoint
            };

            await _authenticatedVaultClient.EnableAuthenticationBackendAsync(authBackend);

            await _authenticatedVaultClient.WriteSecretAsync(prefix + "/users/" + username, new Dictionary <string, object>
            {
                { "password", password },
                { "policies", "root" }
            });

            var authBackends = await userPassClient.GetAllEnabledAuthenticationBackendsAsync();

            Assert.True(authBackends.Data.Any());

            await _authenticatedVaultClient.DisableAuthenticationBackendAsync(authBackend.AuthenticationPath);
        }
Esempio n. 2
0
        private async Task GithubAuthenticationProviderTests()
        {
            // github auth

            var personalAccessToken = "2ba5fecdddbf09b2b6facc495bdae12f3067d9d4";
            var path         = "github" + Guid.NewGuid();
            var prefix       = "auth/" + path;
            var organization = "testingalib";
            var team         = "testalibteam1";

            var githubAuthenticationInfo = new GitHubAuthenticationInfo(path, personalAccessToken);

            var githubClient      = VaultClientFactory.CreateVaultClient(_vaultUri, githubAuthenticationInfo);
            var githubAuthBackend = new AuthenticationBackend {
                BackendType = AuthenticationBackendType.GitHub, AuthenticationPath = githubAuthenticationInfo.MountPoint
            };

            await _authenticatedVaultClient.EnableAuthenticationBackendAsync(githubAuthBackend);

            await _authenticatedVaultClient.WriteSecretAsync(prefix + "/config", new Dictionary <string, object> {
                { "organization", organization }
            });

            await _authenticatedVaultClient.WriteSecretAsync(prefix + "/map/teams/" + team, new Dictionary <string, object> {
                { "value", "root" }
            });

            var authBackends = await githubClient.GetAllEnabledAuthenticationBackendsAsync();

            Assert.True(authBackends.Data.Any());

            await _authenticatedVaultClient.DisableAuthenticationBackendAsync(githubAuthBackend.AuthenticationPath);
        }
        static void Main()
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            var auth = new AuthenticationBackend();

            System.Windows.Forms.Application.Run(auth.FrontEndForm);
        }
Esempio n. 4
0
        public AppForm(AuthenticationBackend auth)
        {
            InitializeComponent();
            _auth_controller     = auth;
            statusLobbyUser.Text = "User: " + _auth_controller.ConnectedUser;
            var lobby = tabsControl.TabPages[0];

            tabsControl.TabPages.Clear();
            tabsControl.TabPages.Add(lobby);

            _lobby_controller = new LobbyBackend(this.lobbyServersList);
        }