Beispiel #1
0
        private static MsaAuthentication GetDevOpsMsaAuthentication(RuntimeContext context, string @namespace)
        {
            ICredentialStore tokenStore1   = new SecretCache(context, @namespace + 1, Secret.UriToIdentityUrl);
            ITokenStore      tokenStore2   = new SecretCache(context, @namespace + 2, Secret.UriToIdentityUrl);
            IAuthority       liveAuthority = new AuthorityFake(null);

            return(new MsaAuthentication(context, tokenStore1, tokenStore2, liveAuthority));
        }
        private static VstsMsaAuthentication GetVstsMsaAuthentication(RuntimeContext context, string @namespace)
        {
            ICredentialStore tokenStore1   = new SecretCache(context, @namespace + 1, Secret.UriToIdentityUrl);
            ITokenStore      tokenStore2   = new SecretCache(context, @namespace + 2, Secret.UriToIdentityUrl);
            IVstsAuthority   liveAuthority = new AuthorityFake(VstsMsaAuthentication.QueryParameters);

            return(new VstsMsaAuthentication(context, tokenStore1, tokenStore2, liveAuthority));
        }
        private static VstsMsaAuthentication GetVstsMsaAuthentication(string @namespace)
        {
            ICredentialStore tokenStore1   = new SecretCache(@namespace + 1);
            ITokenStore      tokenStore2   = new SecretCache(@namespace + 2);
            IVstsAuthority   liveAuthority = new AuthorityFake(VstsMsaAuthentication.QueryParameters);

            return(new VstsMsaAuthentication(tokenStore1, tokenStore2, liveAuthority));
        }
Beispiel #4
0
        private VstsAadAuthentication GetVstsAadAuthentication(string @namespace)
        {
            ICredentialStore tokenStore1   = new SecretCache(@namespace + 1);
            ITokenStore      tokenStore2   = new SecretCache(@namespace + 2);
            IVstsAuthority   vstsAuthority = new AuthorityFake();

            return(new VstsAadAuthentication(tokenStore1, tokenStore2, vstsAuthority));
        }
Beispiel #5
0
        private VsoMsaAuthentication GetVsoMsaAuthentication(string @namespace)
        {
            ICredentialStore tokenStore1   = new SecretCache(@namespace + 1);
            ITokenStore      tokenStore2   = new SecretCache(@namespace + 2);
            ITokenStore      tokenStore3   = new SecretCache(@namespace + 3);
            IVsoAuthority    liveAuthority = new AuthorityFake();

            return(new VsoMsaAuthentication(tokenStore1, tokenStore2, tokenStore3, liveAuthority));
        }
        private static VstsAadAuthentication GetVstsAadAuthentication(RuntimeContext context, string @namespace)
        {
            string expectedQueryParameters = null;

            ICredentialStore tokenStore1   = new SecretCache(context, @namespace + 1, Secret.UriToIdentityUrl);
            ITokenStore      tokenStore2   = new SecretCache(context, @namespace + 2, Secret.UriToIdentityUrl);
            IVstsAuthority   vstsAuthority = new AuthorityFake(expectedQueryParameters);

            return(new VstsAadAuthentication(context, tokenStore1, tokenStore2, vstsAuthority));
        }
        private static VstsAadAuthentication GetVstsAadAuthentication(string @namespace)
        {
            string expectedQueryParameters = null;

            ICredentialStore tokenStore1   = new SecretCache(@namespace + 1);
            ITokenStore      tokenStore2   = new SecretCache(@namespace + 2);
            IVstsAuthority   vstsAuthority = new AuthorityFake(expectedQueryParameters);

            return(new VstsAadAuthentication(tokenStore1, tokenStore2, vstsAuthority));
        }
        public void SecretInCache()
        {
            _cachedSecrets = new[]
            {
                ClearSecretBuilder.Create().AnInstance(),
                    ClearSecretBuilder.Create().WithName("Test2").WithValue("Test2Value").AnInstance()
            };

            SecretCache.GetAllForApplication(clearSecret.ApplicationName).Returns(_cachedSecrets);
        }
Beispiel #9
0
        private static VstsAadAuthentication GetVstsAadAuthentication(string @namespace, string loginHint)
        {
            string expectedQueryParamters = null;

            if (loginHint != null)
            {
                expectedQueryParamters = "login_hint=" + loginHint;
            }

            ICredentialStore tokenStore1   = new SecretCache(@namespace + 1);
            ITokenStore      tokenStore2   = new SecretCache(@namespace + 2);
            IVstsAuthority   vstsAuthority = new AuthorityFake(expectedQueryParamters);

            return(new VstsAadAuthentication(tokenStore1, tokenStore2, vstsAuthority, loginHint));
        }
Beispiel #10
0
        public async Task UserinfoAndUsername()
        {
            const string Namespace = "test";

            var credentialCache     = new SecretCache(RuntimeContext.Default, Namespace);
            var basicAuthentication = new BasicAuthentication(RuntimeContext.Default, credentialCache);
            var targetUri           = new Uri("https://[email protected]");

            var credentials = new Credential("real", "pass");
            await basicAuthentication.SetCredentials(targetUri, credentials);

            var expected = Secret.UriToName(targetUri, Namespace);

            Assert.Contains(credentialCache.EnumerateSecrets(),
                            k => k.Name.Equals(expected, StringComparison.OrdinalIgnoreCase));
        }
        private BasicAuthentication GetBasicAuthentication(string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(@namespace);

            return(new BasicAuthentication(credentialStore, NtlmSupport.Auto, null, null));
        }
Beispiel #12
0
        private BasicAuthentication GetBasicAuthentication(RuntimeContext context, string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(context, @namespace);

            return(new BasicAuthentication(context, credentialStore, NtlmSupport.Auto, null, null));
        }
        private BasicAuthentication GetBasicAuthentication(string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(@namespace);

            return new BasicAuthentication(credentialStore, NtlmSupport.Auto, null, null);
        }
 public void SecretNotInCache()
 {
     SecretCache.Get(Arg.Any <string>(), Arg.Any <string>()).Returns(default(ClearSecret));
 }
 public void SecretAddedToCache()
 {
     SecretCache.Received(1).Add(_returnedSecret);
 }
Beispiel #16
0
 public void RecordCachedSecrets()
 {
     SecretCache
     .When(sc => sc.AddMany(Arg.Any <IEnumerable <ClearSecret> >()))
     .Do(ci => _cachedSecrets = ci.Arg <IEnumerable <ClearSecret> >());
 }
Beispiel #17
0
 public void SecretNotInCache()
 {
     SecretCache.GetAllForApplication(clearSecret.ApplicationName).Returns(default(IEnumerable <ClearSecret>));
 }
Beispiel #18
0
 public void SecretInCache()
 {
     SecretCache.Get(clearSecret.ApplicationName, clearSecret.Name).Returns(clearSecret);
 }
 public void SecretNotInCache()
 {
     SecretCache
     .GetAsync(Arg.Any <string>(), Arg.Any <string>())
     .Returns(Task.FromResult(default(ClearSecret)));
 }
 public void SecretInCache()
 {
     SecretCache
     .GetAsync(clearSecret.ApplicationName, clearSecret.Name)
     .Returns(Task.FromResult(clearSecret));
 }
Beispiel #21
0
        private Authentication GetBitbucketAuthentication(string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(@namespace);

            return(new Authentication(credentialStore, null, null));
        }
Beispiel #22
0
        private Authentication GetBitbucketAuthentication(RuntimeContext context, string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(context, @namespace);

            return(new Authentication(context, credentialStore, null, null));
        }
        private BasicAuthentication GetBasicAuthentication(string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(@namespace);

            return(new BasicAuthentication(credentialStore));
        }
 public void UnprotectedSecretAddedToCache()
 {
     SecretCache.Received(1).Add(clearSecret);
 }
 private VstsMsaAuthentication GetVstsMsaAuthentication(string @namespace)
 {
     ICredentialStore tokenStore1 = new SecretCache(@namespace + 1);
     ITokenStore tokenStore2 = new SecretCache(@namespace + 2);
     ITokenStore tokenStore3 = new SecretCache(@namespace + 3);
     IVstsAuthority liveAuthority = new AuthorityFake();
     return new VstsMsaAuthentication(tokenStore1, tokenStore2, tokenStore3, liveAuthority);
 }
        private BasicAuthentication GetBasicAuthentication(string @namespace)
        {
            ICredentialStore credentialStore = new SecretCache(@namespace);

            return new BasicAuthentication(credentialStore);
        }