Beispiel #1
0
        protected async override Task <ClaimsIdentity> GenerateClaimsAsync(ApplicationUser user)
        {
            var claims = await base.GenerateClaimsAsync(user);

            var startechs = dbContext.MappingStartechs.Where(x => x.ApplicationUserId == user.Id);

            claims.AddClaims(startechs.Select(x => new Claim(StartechClaimHelper.GetStartechClaimType(x.Startech), x.IsLeader ? StartechClaimHelper.Leader :  StartechClaimHelper.Member)));
            return(claims);
        }
 public async Task startech_claims_should_be_send_to_blazor_clients()
 {
     var claimToTransfert = new Claim(StartechClaimHelper.GetStartechClaimType(Startechs.Dotnet), StartechClaimHelper.Member);
     var profileRequest = new ProfileDataRequestContext
     {
         Subject = new ClaimsPrincipal(new ClaimsIdentity(new[] { claimToTransfert }))
     };
     await Target.GetProfileDataAsync(profileRequest);
     profileRequest.IssuedClaims.Select(x => x.Type).Should().BeEquivalentTo(claimToTransfert.Type);
     profileRequest.IssuedClaims.Select(x => x.Value).Should().BeEquivalentTo(claimToTransfert.Value);
 }