Exemplo n.º 1
0
        public override ClaimsPrincipal ValidateToken(string token, TokenValidationParameters validationParameters, out SecurityToken validatedToken)
        {
            ClaimsPrincipal   principal      = base.ValidateToken(token, validationParameters, out validatedToken);
            var               parsedToken    = base.ReadJwtToken(token);
            CampaignIdentity  identity       = CampaignIdentity.ToIdentity(principal.Identity as ClaimsIdentity, this._httpContext);
            CampaignPrincipal ndCrmPrincipal = new CampaignPrincipal(identity);

            return(ndCrmPrincipal);
        }
Exemplo n.º 2
0
        public static CampaignIdentity ToIdentity(ClaimsIdentity identity,
                                                  HttpContext httpContext)
        {
            CampaignIdentity myIdentity = new CampaignIdentity(identity,
                                                               identity.Claims,
                                                               identity.AuthenticationType,
                                                               identity.NameClaimType,
                                                               identity.RoleClaimType
                                                               );

            return(myIdentity);
        }
        public async Task <ClaimsIdentity> CheckUserLogin(string userName, string password)
        {
            IUser user = null;

            user = await this._userRepository.CheckLogin(userName, password);

            if (!string.IsNullOrEmpty(user.userName))
            {
                CampaignIdentity myIdentity = new CampaignIdentity(new GenericIdentity(
                                                                       user.userName),
                                                                   new List <Claim>(),
                                                                   "Standard", "name", "role",
                                                                   user);
                return(myIdentity);
            }

            return(null);
        }
Exemplo n.º 4
0
 public CampaignPrincipal(CampaignIdentity identity) : base()
 {
     this._identity     = identity;
     identity.Principal = this;
     this.AddIdentity(identity);
 }