public void StartInteracting()
 {
     foreach (var item in metagen_comp.userMetaData)
     {
         User         user     = item.Key;
         UserMetadata metadata = item.Value;
         if (!(metadata.isRecording || metagen_comp.record_everyone))
         {
             continue;
         }
         UniLog.Log("Starting voice interaction for user " + user.UserName);
         RefID user_id = user.ReferenceID;
         current_users_ids.Add(user_id.ToString());
         AvatarAudioOutputManager comp = user.Root.Slot.GetComponentInChildren <AvatarAudioOutputManager>();
         AudioOutput audio_output      = comp.AudioOutput.Target;
         audio_outputs[user_id] = audio_output;
         isRecording[user_id]   = false;
         if (audio_outputs[user_id] == null)
         {
             UniLog.Log("OwO: Audio output for user " + user_id.ToString() + " is null!");
         }
         else
         {
             UniLog.Log("Sample rate");
             UniLog.Log(metagen_comp.Engine.AudioSystem.Connector.SampleRate.ToString());
         }
     }
     isInteracting = true;
 }
        public QueryResultResource(QueryResult result, UrlHelper url, UserMetadata meta)
        {
            if (result == null)
            {
                throw new ArgumentNullException("user");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            if (meta == null)
            {
                throw new ArgumentNullException("meta");
            }

            Data = new QueryResultResourceData(result, url, meta);

            var links = new Dictionary <string, object>();

            if (meta.SupportsCreate)
            {
                links["create"] = new CreateUserLink(url, meta);
            }
            ;
            Links = links;
        }
Example #3
0
        public Task <UserManagementMetadata> GetMetadataAsync()
        {
            var createUserProperties = new List <PropertyMetadata>
            {
                new PropertyMetadata(PropertyTypes.String, Core.Constants.ClaimTypes.Name, "Name", true),
                new PropertyMetadata(PropertyTypes.Password, Core.Constants.ClaimTypes.Password, "Password", true),
                new PropertyMetadata(PropertyTypes.Email, Core.Constants.ClaimTypes.Email, "Email", true),
                new PropertyMetadata(PropertyTypes.String, Core.Constants.ClaimTypes.Role, "Role", false)
            };

            var updateUserProperties = new List <PropertyMetadata>
            {
                new PropertyMetadata(PropertyTypes.String, Core.Constants.ClaimTypes.Name, "Name", true)
            };


            var createRoleProperties = new List <PropertyMetadata>
            {
                new PropertyMetadata(PropertyTypes.String, Core.Constants.ClaimTypes.Name, "Name", true),
                new PropertyMetadata(PropertyTypes.String, Core.Constants.ClaimTypes.Description, "Description", true)
            };

            var updateRoleProperties = new List <PropertyMetadata>
            {
                new PropertyMetadata(PropertyTypes.String, Core.Constants.ClaimTypes.Description, "Description", true)
            };

            var userMetadata = new UserMetadata(true, true, true, updateUserProperties, createUserProperties);
            var roleMetadata = new RoleMetadata(true, true, Core.Constants.ClaimTypes.Role, updateRoleProperties, createRoleProperties);

            return(Task.FromResult(new UserManagementMetadata(userMetadata, roleMetadata)));
        }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="UserMetadata" />.</param>
 /// <returns>
 /// an instance of <see cref="UserMetadata" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         UserMetadata.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new UserMetadata
         {
             Name = sourceValue.Name,
             Categories = sourceValue.Categories,
             CreationTime = sourceValue.CreationTime,
             Kind = sourceValue.Kind,
             LastUpdateTime = sourceValue.LastUpdateTime,
             OwnerReference = UserReferenceTypeConverter.ConvertFrom(sourceValue.OwnerReference),
             ProjectReference = ProjectReferenceTypeConverter.ConvertFrom(sourceValue.ProjectReference),
             SpecHash = sourceValue.SpecHash,
             SpecVersion = sourceValue.SpecVersion,
             Uuid = sourceValue.Uuid,
         });
     }
     catch
     {
     }
     return(null);
 }
Example #5
0
        public async Task <IActionResult> OnPostInitializeAsync()
        {
            if ((await CanAdmin()) == false)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            HttpClient      httpclient = clientFactory.CreateClient();
            WorkspaceClient client     = new WorkspaceClient(httpclient);
            await client.InitializeAsync();

            UserMetadata rawUser = new UserMetadata {
                Email = "admin@localhost", Name = "Admin"
            };
            await _userManager.CreateAsync(rawUser, "admin");

            {
                UsersClient  ucli = new UsersClient(httpclient);
                UserMetadata user = await ucli.GetByNameAsync(rawUser.NormalizedName);

                ProblemsClient pcli = new ProblemsClient(httpclient);
                await pcli.CreateAsync(Helpers.Problems.GetAPlusB(user.Id));
            }

            return(RedirectToPage());
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            UserMetadata user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."));
            }

            IdentityResult changePasswordResult = await _userManager.ChangePasswordAsync(user, Input.OldPassword, Input.NewPassword);

            if (!changePasswordResult.Succeeded)
            {
                foreach (IdentityError error in changePasswordResult.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
                return(Page());
            }

            await _signInManager.RefreshSignInAsync(user);

            StatusMessage = "Your password has been changed.";

            return(RedirectToPage());
        }
        public QueryResultResourceData(QueryResult result, UrlHelper url, UserMetadata meta)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            if (meta == null)
            {
                throw new ArgumentNullException("meta");
            }

            AutoMapper.Mapper.Map(result, this);

            foreach (var user in this.Users)
            {
                var links = new Dictionary <string, string> {
                    { "Detail", url.Link(Constants.RouteNames.GetUser, new { subject = user.Data.Subject }) }
                };
                if (meta.SupportsDelete)
                {
                    links.Add("delete", url.Link(Constants.RouteNames.DeleteUser, new { subject = user.Data.Subject }));
                }
                user.Links = links;
            }
        }
Example #8
0
        public ActionResult Autherize(UserMetadata userModel)
        {
            using (OnlineVotingSystemEntities db = new OnlineVotingSystemEntities())
            {
                if (userModel.Email != null && userModel.Password != null)
                {
                    var userDetails = db.Users.Where(x => x.Email == userModel.Email && x.Password == userModel.Password).FirstOrDefault();
                    if (userDetails == null)
                    {
                        userModel.LoginErrorMessage = "Wrong email or password!";
                        return(View("Index", userModel));
                    }
                    else
                    {
                        Session["userEmail"] = userDetails.Email;
                        Session["userType"]  = "Admin";
                        return(RedirectToAction("Index", "Home"));
                    }
                }

                else
                {
                    return(View("Index", userModel));
                }
            }
        }
Example #9
0
        public User createADemoUser()
        {
            UserMetaDataModel model = new UserMetaDataModel {
                FirstName          = "Hellen",
                LastName           = "Brown",
                Dob                = DateTime.Now,
                StreetAddressLine1 = "10811 AshtonAve",
                StreetAddressLine2 = "",
                State              = "CA",
                ZipCode            = "90424",
                Income             = BigInteger.Parse("140000"),
                Occupation         = "Engineer"
            };

            UserMetadata userMetadata = new UserMetadata
            {
                Uid = "304-497-354"
            };

            userMetadata.UserMetaDataModel = model;

            User user1 = new User
            {
                Uid = "304-497-354",
            };

            return(userData.Add(user1, userMetadata));
        }
        public void FinalizeAnswer(string itemId, string answer)
        {
            string recId = Guid.NewGuid().ToString();
            // Create a dummy recording so that we can save it to the database
            Recording rec = new Recording
            {
                RecordingId  = recId,
                ItemId       = itemId,
                FileName     = $"{recId}-{Constants.MetadataWithoutRecording}",
                ClientId     = Preferences.Get(Constants.ClientIdKey, "unknown"),
                Timestamp    = DateTime.UtcNow,
                UploadStatus = UploadStatus.Pending
            };

            RecordingMetadata metadata = new RecordingMetadata(rec.RecordingId);

            metadata.ClientId           = rec.ClientId;
            metadata.ItemId             = rec.ItemId;
            metadata.RecordingTimestamp = rec.Timestamp;

            // Add user metadata based on the item view model
            var umd        = new UserMetadata();
            var userAnswer = new UserAnswer();

            userAnswer.ItemId = itemId;
            userAnswer.Value  = answer;
            umd.AddAnswer(userAnswer);

            metadata.User = umd;

            rec.Metadata = metadata.ToJsonString();

            App.Database.SaveRecordingAsync(rec);
            Debug.WriteLine($"Saved answer '{answer}', recording '{rec.RecordingId}', item '{itemId}'");
        }
Example #11
0
        private void ValidateUpdateProperty(UserMetadata userMetadata, string type, string value)
        {
            if (userMetadata == null)
            {
                throw new ArgumentNullException(nameof(userMetadata));
            }

            if (IsNullOrWhiteSpace(type))
            {
                ModelState.AddModelError("", Messages.PropertyTypeRequired);
                return;
            }

            var prop = userMetadata.UpdateProperties.SingleOrDefault(x => x.Type == type);

            if (prop == null)
            {
                ModelState.AddModelError("", Format(Messages.PropertyInvalid, type));
            }
            else
            {
                var error = prop.Validate(value);
                if (error != null)
                {
                    ModelState.AddModelError("", error);
                }
            }
        }
Example #12
0
        async Task <bool> CheckModel(bool isImport)
        {
            if (ModelState.IsValid == false)
            {
                return(false);
            }
            if (!isImport)
            {
                try
                {
                    UserMetadata user = await _userManager.GetUserAsync(User);

                    if (await _userManager.GetUserIdAsync(user) != PostData.Metadata.UserId)
                    {
                        return(false);
                    }
                }
                catch
                {
                    return(false);
                }
            }
            else
            {
                if (PostData.ImportFile == null)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #13
0
        public async Task <UserModel> GetUserModel(string token, Auth0ConfigModel objAuth0Config, User user)
        {
            if (user != null)
            {
                var               managementApiClient = new ManagementApiClient(token, objAuth0Config.Domain);
                PaginationInfo    pagination          = new PaginationInfo();
                IPagedList <Role> userRoles           = await managementApiClient.Users.GetRolesAsync(user.UserId, pagination);

                UserMetadata meta = !string.IsNullOrEmpty(Convert.ToString(user.UserMetadata)) ? JsonConvert.DeserializeObject <UserMetadata>(user.UserMetadata.ToString()) : null;

                var userRole = userRoles.Count > 0 ? userRoles[0].Name : "n/a";;

                UserModel objUser = new UserModel
                {
                    Email       = user.Email,
                    FirstName   = user.FirstName,
                    LastName    = user.LastName,
                    PhoneNumber = user.PhoneNumber,
                    PictureUrl  = meta?.Picture,
                    ReportsTo   = meta?.ReportsTo,
                    Role        = userRole
                };

                return(objUser);
            }

            return(null);
        }
Example #14
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            UserMetadata user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."));
            }

            string email = await _userManager.GetEmailAsync(user);

            if (Input.Email != email)
            {
                IdentityResult setEmailResult = await _userManager.SetEmailAsync(user, Input.Email);

                if (!setEmailResult.Succeeded)
                {
                    string userId = await _userManager.GetUserIdAsync(user);

                    throw new InvalidOperationException($"Unexpected error occurred setting email for user with ID '{userId}'.");
                }
            }

            await _signInManager.RefreshSignInAsync(user);

            StatusMessage = "Your profile has been updated";
            return(RedirectToPage());
        }
Example #15
0
        private void OnDoWork(object sender, DoWorkEventArgs e)
        {
            UserMetadata user = new UserMetadata();

            user.Username = this.Username;
            e.Result      = user.Login(this.Password);
        }
        public UserDetailResource(UserDetail user, UrlHelper url, UserMetadata meta)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            if (meta == null)
            {
                throw new ArgumentNullException("meta");
            }

            Data = new UserDetailDataResource(user, url, meta);

            var links = new Dictionary <string, string>();

            if (meta.SupportsDelete)
            {
                links["Delete"] = url.Link(Constants.RouteNames.DeleteUser, new { subject = user.Subject });
            }
            this.Links = links;
        }
Example #17
0
 private static void OnLoginSuccessful(AwfulLoginClient sender, string username, List<Cookie> cookie)
 {
     if (LoginSuccessful != null)
     {
         var user = new UserMetadata() { Username = username, Cookies = cookie };
         LoginSuccessful(sender, new LoginEventArgs(user));
     }
 }
Example #18
0
        public User Add(User newUser, UserMetadata userMetadata)
        {
            newUser.UserMetadata = userMetadata;

            db.Add(newUser);
            Commit();
            return(newUser);
        }
        public void Serialize()
        {
            var userProviders = new List <UserProvider>
            {
                new UserProvider()
                {
                    Uid        = "google.uid",
                    ProviderId = "google.com",
                },
            };

            var customClaims = new Dictionary <string, object>()
            {
                { "admin", true },
            };

            var userMetadata = new UserMetadata(1, 2, null);
            var passwordHash = Encoding.ASCII.GetBytes("secret");
            var passwordSalt = Encoding.ASCII.GetBytes("salt");

            var importUserRecordArgs = new ImportUserRecordArgs()
            {
                Uid           = "123",
                Email         = "*****@*****.**",
                EmailVerified = true,
                DisplayName   = "Example",
                PhotoUrl      = "http://example.com/photo",
                PhoneNumber   = "+11234567890",
                Disabled      = false,
                UserMetadata  = userMetadata,
                PasswordHash  = passwordHash,
                PasswordSalt  = passwordSalt,
                CustomClaims  = customClaims,
                UserProviders = userProviders,
            };

            var expected = new Dictionary <string, object>()
            {
                { "createdAt", userMetadata.CreationTimestamp },
                { "customAttributes", JsonConvert.SerializeObject(customClaims) },
                { "disabled", false },
                { "displayName", "Example" },
                { "email", "*****@*****.**" },
                { "emailVerified", true },
                { "lastLoginAt", userMetadata.LastSignInTimestamp },
                { "passwordHash", JwtUtils.UrlSafeBase64Encode(passwordHash) },
                { "salt", JwtUtils.UrlSafeBase64Encode(passwordSalt) },
                { "phoneNumber", "+11234567890" },
                { "photoUrl", "http://example.com/photo" },
                { "providerUserInfo", userProviders.Select(userProvider => userProvider.ToRequest()) },
                { "localId", "123" },
            };

            Assert.Equal(
                JsonConvert.SerializeObject(expected),
                JsonConvert.SerializeObject(importUserRecordArgs.ToRequest()));
        }
Example #20
0
        public void should_have_called_executable_process_when_firewall_rule_is_available_with_metadata()
        {
            Setup();
            NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(true);

            UserMetadata.Add("build_config");
            SetProviderData.Execute(ProviderData, UserMetadata);
            ExecutableProcessQueue.AssertWasCalled(
                queue => queue.Enqueue("netsh", "advfirewall firewall set rule name=\"RS_FIREWALL_RULE\" new enable=yes remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79"));
        }
Example #21
0
        private static void TranslateToMetadata(UserMetadata md, User user)
        {
            // can be null if user is DO or when deleting user
            md.DelegationToken = user.DelegationToken != null?ConvertBinary(user.DelegationToken.ToUser) : null;

            md.Id   = user.Id;
            md.Name = user.Name != null?ConvertBinary(user.Name) : null;    // can be null when deleting user by clearing his name

            md.SignPublicKey = ConvertBinary(user.SignPublicKey);
        }
Example #22
0
 public async Task SetMetadata(UserMetadata value)
 {
     _user.Name            = value.Name;
     _user.NormalizedName  = value.NormalizedName;
     _user.Email           = value.Email;
     _user.EmailConfirmed  = value.EmailConfirmed;
     _user.NormalizedEmail = value.NormalizedEmail;
     _user.PasswordHash    = value.PasswordHash;
     await _context.SaveChangesAsync();
 }
Example #23
0
        public IdentityManagerMetadata GetStandardMetadata(bool includeAccountProperties = true)
        {
            var update = new List <PropertyMetadata>();

            if (this.userManager.SupportsUserPassword)
            {
                update.Add(PropertyMetadata.FromFunctions <TUser, string>(Constants.ClaimTypes.Password, x => null, SetPassword, name: "Password", dataType: PropertyDataType.Password, required: true));
            }
            if (this.userManager.SupportsUserEmail)
            {
                update.Add(PropertyMetadata.FromFunctions <TUser, string>(Constants.ClaimTypes.Email, GetEmail, SetEmail, name: "Email", dataType: PropertyDataType.Email));
            }
            if (this.userManager.SupportsUserPhoneNumber)
            {
                update.Add(PropertyMetadata.FromFunctions <TUser, string>(Constants.ClaimTypes.Phone, GetPhone, SetPhone, name: "Phone", dataType: PropertyDataType.String));
            }

            if (includeAccountProperties)
            {
                update.AddRange(PropertyMetadata.FromType <TUser>());
            }

            var create = new List <PropertyMetadata>();

            create.Add(PropertyMetadata.FromProperty <TUser>(x => x.UserName, type: Constants.ClaimTypes.Username, required: true));
            create.Add(PropertyMetadata.FromFunctions <TUser, string>(Constants.ClaimTypes.Password, x => null, SetPassword, name: "Password", dataType: PropertyDataType.Password, required: true));

            var user = new UserMetadata
            {
                SupportsCreate   = true,
                SupportsDelete   = true,
                SupportsClaims   = this.userManager.SupportsUserClaim,
                CreateProperties = create,
                UpdateProperties = update
            };

            var role = new RoleMetadata
            {
                RoleClaimType    = Constants.ClaimTypes.Role,
                SupportsCreate   = true,
                SupportsDelete   = true,
                CreateProperties = new PropertyMetadata[] {
                    PropertyMetadata.FromProperty <TRole>(x => x.Name, type: Constants.ClaimTypes.Name, required: true),
                }
            };

            var meta = new IdentityManagerMetadata
            {
                UserMetadata = user,
                RoleMetadata = role
            };

            return(meta);
        }
Example #24
0
        private static User TranslateFromMetadata(UserMetadata md)
        {
            User u = new User();

            u.DelegationToken = md.DelegationToken != null ? new DelegationToken(ConvertBinary(md.DelegationToken)) : null;
            u.Id   = md.Id;
            u.Name = md.Name != null?ConvertBinary(md.Name) : null;

            u.SignPublicKey = ConvertBinary(md.SignPublicKey);

            return(u);
        }
Example #25
0
        public async Task <IUserProvider> Create(UserMetadata metadata)
        {
            User empty = new User();

            _context.Users.Add(empty);
            await _context.SaveChangesAsync();

            UserProvider res = new UserProvider(_workspace, _context, empty);
            await res.SetMetadata(metadata);

            return(res);
        }
        public static IEnumerable <PropertyMetadata> GetCreateProperties(this UserMetadata userMetadata)
        {
            if (userMetadata == null)
            {
                throw new ArgumentNullException("GetCreateProperties::userMetadata " + ExceptionMessages.IsNotAssigned);
            }

            var exclude    = userMetadata.CreateProperties.Select(x => x.Type);
            var additional = userMetadata.UpdateProperties.Where(x => !exclude.Contains(x.Type) && x.Required);

            return(userMetadata.CreateProperties.Union(additional));
        }
Example #27
0
        private IEnumerable <string> ValidateCreateProperties(UserMetadata userMetadata, IEnumerable <PropertyValue> properties)
        {
            if (userMetadata == null)
            {
                throw new ArgumentNullException(nameof(userMetadata));
            }
            properties = properties ?? Enumerable.Empty <PropertyValue>();

            var meta = userMetadata.GetCreateProperties();

            return(meta.Validate(properties));
        }
Example #28
0
        public static async Task <string> TryGetUserEmail(ClaimsPrincipal user, UserManager <UserMetadata> manager)
        {
            try
            {
                UserMetadata ru = await manager.GetUserAsync(user);

                return(await manager.GetEmailAsync(ru));
            }
            catch
            {
                return("");
            }
        }
Example #29
0
        public async Task <ActionResult <UserMetadata> > Create([FromBody] UserMetadata data)
        {
            try
            {
                IUserProvider res = await _workspace.Users.Create(data);

                return(Created($"users/{res.Id}", await res.GetMetadata()));
            }
            catch
            {
                return(Forbid());
            }
        }
Example #30
0
        public async Task <UserModel> AddUser(UserModel objUserModel, Auth0ConfigModel objAuth0Config)
        {
            MethodCollection methodCollection = new MethodCollection();
            string           token            = await methodCollection.GetAccessToken(objAuth0Config);

            var managementApiClient = new ManagementApiClient(token, objAuth0Config.Domain);

            UserMetadata userMetaData = new UserMetadata();

            userMetaData.ReportsTo = objUserModel.ReportsTo;
            userMetaData.Company   = objUserModel.CompanyName;

            UserCreateRequest createRequest = new UserCreateRequest
            {
                Connection   = objAuth0Config.Connection,
                FirstName    = objUserModel.FirstName,
                LastName     = objUserModel.LastName,
                Email        = objUserModel.Email,
                Password     = objUserModel.Password,
                PhoneNumber  = objUserModel.PhoneNumber,
                UserMetadata = userMetaData
            };

            User addedUser = await managementApiClient.Users.CreateAsync(createRequest);

            if (objUserModel.Role.Length > 0)
            {
                List <string> roles = new List <string>
                {
                    objUserModel.Role
                };

                UserRole objUserRole = new UserRole
                {
                    UserId    = addedUser.UserId,
                    RoleNames = roles
                };
                await this.AddUserToRoles(objUserRole, objAuth0Config);
            }


            UserModel newUser = new UserModel
            {
                Email       = addedUser.Email,
                FirstName   = addedUser.FirstName,
                LastName    = addedUser.LastName,
                PhoneNumber = addedUser.PhoneNumber,
            };

            return(newUser);
        }
Example #31
0
        public Task <UserManagementMetadata> GetMetadataAsync()
        {
            var createProperties = new List <PropertyMetadata>
            {
                new PropertyMetadata(PropertyTypes.String, ClaimTypes.Name, "Name", true),
                new PropertyMetadata(PropertyTypes.Password, ClaimTypes.Password, "Password", true),
                new PropertyMetadata(PropertyTypes.Email, ClaimTypes.Email, "Email", false)
            };

            var userMetadata = new UserMetadata(true, false, false, Enumerable.Empty <PropertyMetadata>(), createProperties);
            var roleMetadata = new RoleMetadata(false, false, ClaimTypes.Role, Enumerable.Empty <PropertyMetadata>(), Enumerable.Empty <PropertyMetadata>());

            return(Task.FromResult(new UserManagementMetadata(userMetadata, roleMetadata)));
        }
Example #32
0
 private void OnDoWork(object sender, DoWorkEventArgs e)
 {
     UserMetadata user = new UserMetadata();
     user.Username = this.Username;
     e.Result = user.Login(this.Password);
 }
Example #33
0
 /// <summary>
 /// Removes the cookies for all global web requests. Any future requests which require
 /// authentication will fail until credentials are set again.
 /// </summary>
 internal static void ClearCredentials()
 {
     _user = null;
     _cookieJar.Clear();
 }
Example #34
0
 internal LoginEventArgs(UserMetadata metadata)
 {
     this.User = metadata;
 }
Example #35
0
 /// <summary>
 /// Sets the global cookie container for all future web requests to that of the specified user.
 /// If the user has invalid cookies, future requests may fail. This method is typically called
 /// after authentication cookies are obtained.
 /// </summary>
 /// <param name="user">The specified user.</param>
 internal static void SetCredentials(UserMetadata user)
 {
     _user = user;
     SetCookieJar(user.Cookies);
 }
Example #36
0
 public void SetUserAndProceed(UserMetadata user)
 {
     AwfulWebRequest.SetCredentials(user);
     this.Ignore = true;
 }