/// <summary> /// Add claims to the identity /// </summary> public void AddClaimsToIdentity(User user, ClaimsIdentity identity) { ClaimHelper.SetIdentity(identity); ClaimHelper.AddClaim(new Claim(CaresUserClaims.UserDomainKey, user.UserDomainKey.ToString())); AddDomainLicenseDetailClaims(user.UserDomainKey); ClaimHelper.SetCurrentPrincipal(); IList <DomainLicenseDetailClaim> claim = ClaimHelper.GetClaimsByType <DomainLicenseDetailClaim>(CaresUserClaims.DomainLicenseDetail); }
/// <summary> /// Add Organisation Claims /// </summary> private void AddDomainLicenseDetailClaims(double domainKey) { DomainLicenseDetail domainLicenseDetail = domainLicenseDetailsRepository.GetDomainLicenseDetailByDomainKey(domainKey); if (domainLicenseDetail != null) { ClaimHelper.AddClaim(new Claim(CaresUserClaims.DomainLicenseDetail, ClaimHelper.Serialize( new DomainLicenseDetailClaim { UserDomainKey = domainLicenseDetail.UserDomainKey, Branches = domainLicenseDetail.Branches, FleetPools = domainLicenseDetail.FleetPools, Employee = domainLicenseDetail.Employee, RaPerMonth = domainLicenseDetail.RaPerMonth, Vehicles = domainLicenseDetail.Vehicles }), typeof(DomainLicenseDetailClaim).AssemblyQualifiedName)); } }