/// <summary>
        ///
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public Page <AuthenticationUsers> Paginated(FindRequestImpl <SearchFilter> filter)
        {
            AuthenticationUsers u = null;
            var qUsuarios2        = CurrentSession.Query <AuthenticationUsers>();

            return(Paginated(qUsuarios2, filter.PageRequest));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var allowedOrigin = context.OwinContext.Get <string>("as:clientAllowedOrigin");

            if (allowedOrigin == null)
            {
                allowedOrigin = "*";
            }

            if (context.OwinContext.Response.Headers.ContainsKey("Access-Control-Allow-Origin"))
            {
                context.OwinContext.Response.Headers["Access-Control-Allow-Origin"] = allowedOrigin;
            }
            else
            {
                context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { allowedOrigin });
            }

            long userCurKotikoBlog   = 0;
            AuthenticationUsers user = null;

            user = AuthenticationUsersService.GetByUsernameAndPassword(context.UserName,
                                                                       HelperMethods.GetHash(context.Password));

            if (user == null)
            {
                context.SetError("invalid_grant", "The user name or password is incorrect.");
                return;
            }

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

            identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName));

            var rolesString = string.Join(",", user.Roles.Select(x => StringEnum.GetStringValue(x)).ToArray());

            var props = new AuthenticationProperties(new Dictionary <string, string>
            {
                {
                    "as:client_id", context.ClientId ?? string.Empty
                },
                {
                    "username", context.UserName
                },
                {
                    "roles", rolesString
                },
                {
                    "id", user.Id.ToString()
                },
                {
                    "email", user.Email
                }
            });

            var ticket = new AuthenticationTicket(identity, props);

            context.Validated(ticket);
        }
 public void Update(AuthenticationUsers entity)
 {
     AuthenticationUsersRepository.Update(entity);
 }
        public long Save(AuthenticationUsers entity)
        {
            var id = AuthenticationUsersRepository.Save(entity);

            return id;
        }
Example #5
0
        public IHttpActionResult Update(AuthenticationUsers entity)
        {
            AuthenticationUsersService.Update(entity);

            return(Ok(Mapper.Map <AuthenticationUsersResponse>(entity)));
        }
Example #6
0
        public AuthenticationUsersResponse Save(AuthenticationUsers entity)
        {
            var user = AuthenticationUsersService.Save(entity);

            return(Mapper.Map <AuthenticationUsersResponse>(entity));
        }
        public IHttpActionResult Update(AuthenticationUsers entity)
        {
            AuthenticationUsersService.Update(entity);

            return Ok(Mapper.Map<AuthenticationUsersResponse>(entity));
        }
        public AuthenticationUsersResponse Save(AuthenticationUsers entity)
        {
            var user = AuthenticationUsersService.Save(entity);

            return Mapper.Map<AuthenticationUsersResponse>(entity);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entity"></param>
 public void Update(AuthenticationUsers entity)
 {
     CurrentSession.Update(entity);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public long Save(AuthenticationUsers entity)
 {
     return (long) CurrentSession.Save(entity);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 public void Update(AuthenticationUsers entity)
 {
     CurrentSession.Update(entity);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public long Save(AuthenticationUsers entity)
 {
     return((long)CurrentSession.Save(entity));
 }
 public void Update(AuthenticationUsers entity)
 {
     AuthenticationUsersRepository.Update(entity);
 }
        public long Save(AuthenticationUsers entity)
        {
            var id = AuthenticationUsersRepository.Save(entity);

            return(id);
        }