예제 #1
0
        /// <summary>Set the user for a domain.</summary>
        public void SetUser(string Domain, OAuth2DomainUser User)
        {
            if (User != null)
            {
                if (DomainExists(Domain))
                {
                    info.domains[Domain].users[User.userName] = User;
                    dataStore.SaveInfo(info);
                }
                else
                {
                    OAuth2Domain domain = new OAuth2Domain()
                    {
                        domain = Domain
                    };
                    domain.defaultUser = User.userName;
                    domain.users.Add(User.userName, User);
                    SetDomain(domain);

                    if (!DefaultDomainExists())
                    {
                        SetDefaultDomain(Domain);
                    }
                }
            }
        }
예제 #2
0
        /// <summary>Sets the client secrets for the given domain user.</summary>
        public void SetClientSecrets(string Domain, string UserName, ClientSecrets Secrets)
        {
            if (!UserExists(Domain, UserName))
            {
                OAuth2DomainUser user = new OAuth2DomainUser();
                user.clientSecrets = Secrets;
                //create the domain too
                SetUser(Domain, user);
            }
            else
            {
                info.domains[Domain].users[UserName].clientSecrets = Secrets;

                dataStore.SaveInfo(info);
            }
        }