Ejemplo n.º 1
0
 public UserService(IUserRepo userRepo, IPasswordUtility passwordUtility, ITokenUtility tokenUtility, IMappingService mappingService)
 {
     _userRepo        = userRepo;
     _passwordUtility = passwordUtility;
     _tokenUtility    = tokenUtility;
     _mappingService  = mappingService;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// ctor
 /// </summary>
 public ExternalAuthController(IOptions <FacebookAuthSettings> fbAuthSetting, UserManager <AppUser> userManager, UserContext userContext, ITokenUtility tokenUtility, IOptions <JwtSettingOptions> jwtOptions)
 {
     _fbAuthSettings = fbAuthSetting.Value;
     _userManager    = userManager;
     _userContext    = userContext;
     _tokenUtility   = tokenUtility;
     _jwtOptions     = jwtOptions.Value;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="userManager"></param>
        /// <param name="tokenUtility"></param>
        /// <param name="options"></param>

        public AuthController(UserManager <AppUser> userManager, ITokenUtility tokenUtility, IOptions <JwtSettingOptions> options)
        {
            _userManager  = userManager;
            _tokenUtility = tokenUtility;
            _options      = options.Value;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Generate Jwt token
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="tokenUtility"></param>
        /// <param name="userName"></param>
        /// <param name="jwtOptions"></param>
        /// <param name="serializerSettings"></param>
        /// <returns>return json string</returns>
        public static async Task <string> GenerateJwtJson(this ClaimsIdentity identity, ITokenUtility tokenUtility, string userName, JwtSettingOptions jwtOptions, JsonSerializerSettings serializerSettings)
        {
            var jwt = new
            {
                id         = identity.Claims.Single(c => c.Type == "id").Value,
                auth_token = await tokenUtility.GenerateEncodedToken(userName, identity),
                expires_in = (int)jwtOptions.ValidFor.TotalSeconds
            };

            return(JsonConvert.SerializeObject(jwt, serializerSettings));
        }
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="userRepository"></param>
        /// <param name="tokenUtility"></param>

        public AuthController(IUserRepository userRepository, ITokenUtility tokenUtility)
        {
            _userRepository = userRepository;
            _tokenUtility   = tokenUtility;
        }
 public UserController(IUserService userService, ITokenUtility tokenUtility)
 {
     _userService  = userService;
     _tokenUtility = tokenUtility;
 }