public void GetUserNotification(int UserId)
        {
            SellffDefaultService objSellffDefaultService = new SellffDefaultService();
            var userData = objSellffDefaultService.HeaderWidgetsCountByUserId(UserId);

            Clients.All.SetUserNotification(userData);
        }
Beispiel #2
0
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            SellffDefaultService objSellffDefaultService = new SellffDefaultService();
            var user = objSellffDefaultService.AuthenticateSellffUser(context.UserName, context.Password);

            if (string.IsNullOrWhiteSpace(context.UserName) || string.IsNullOrWhiteSpace(context.Password) ||
                user == null)
            {
                context.Rejected();
                context.SetError("invalid_grant", "The user name or password is incorrect.");
            }

            var identity = new ClaimsIdentity(context.Options.AuthenticationType);

            identity.AddClaim(new Claim("email", user.Email));
            identity.AddClaim(new Claim("username", user.DisplayName));
            context.Validated(identity);
        }
 public SellffDefaultController()
 {
     objSellffDefaultService = new SellffDefaultService();
 }