public async Task <IActionResult> ActivateUserAsync() { var userId = GetCurrentSaasUserId(); await _memberService.ActivateMemberAsync(userId); return(Ok()); }
public async Task ActivateMemberAsync_ShouldActivateMember() { var member = await _memberService.GetMemberByIdAsync(_memberId); Assert.False(member.IsActive); await _memberService.ActivateMemberAsync(member.SaasUserId); var activatedMember = await _memberService.GetMemberByIdAsync(_memberId); Assert.True(activatedMember.IsActive); }
public async Task HandleAsync(AuthorizationHandlerContext context) { const string claimType = "sub"; var saasUserIdClaim = context.User?.Claims.FirstOrDefault(x => x.Type == claimType); if (saasUserIdClaim == null) { return; } await _memberService.ActivateMemberAsync(saasUserIdClaim.Value); context.Succeed(new OperationAuthorizationRequirement()); }