Beispiel #1
0
        /* ---------------------------------------------------------------------- */

        public MacroscopeCredential GetCredential(string Domain, string Realm)
        {
            string Key = this.GenerateKey(Domain, Realm);
            MacroscopeCredential Credential = null;

            lock (this.Credentials)
            {
                if (this.Credentials.ContainsKey(Key))
                {
                    Credential = this.Credentials[Key];
                }
            }

            return(Credential);
        }
Beispiel #2
0
        /** -------------------------------------------------------------------- **/

        private void VerifyOrPurgeCredential()
        {
            if (this.GetAuthenticationCredential() != null)
            {
                this.DebugMsg(string.Format("VerifyCredential: {0}", this.GetStatusCode()));

                if (this.GetStatusCode() == HttpStatusCode.Unauthorized)
                {
                    MacroscopeCredential Credential = this.GetAuthenticationCredential();

                    Credential.GetCredentialsHttp().RemoveCredential(
                        Credential.GetDomain(),
                        Credential.GetRealm()
                        );
                }
            }
        }
Beispiel #3
0
        /* ---------------------------------------------------------------------- */


        public void AddCredential(string Domain, string Realm, string Username, string Password)
        {
            string Key = this.GenerateKey(Domain, Realm);

            lock (this.Credentials)
            {
                if (this.Credentials.ContainsKey(Key))
                {
                    this.Credentials.Remove(Key);
                }

                MacroscopeCredential Credential = new MacroscopeCredential(
                    CredentialsHttp: this,
                    Domain: Domain,
                    Realm: Realm,
                    Username: Username,
                    Password: Password
                    );

                this.Credentials.Add(Key, Credential);
            }
        }