コード例 #1
0
 public AuthController(IUserService userService, IAuthService authService, IRefreshTokenService refreshTokenService, IMapper mapper)
 {
     _userService         = userService;
     _authService         = authService;
     _mapper              = mapper;
     _refreshTokenService = refreshTokenService;
 }
コード例 #2
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ILoggerFactory loggerFactory)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _logger = loggerFactory.CreateLogger<TokenResponseGenerator>();
 }
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, ITokenHandleStore tokenHandles, CoreSettings settings, IAuthorizationCodeStore codes)
 {
     _settings = settings;
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _tokenHandles = tokenHandles;
 }
コード例 #4
0
ファイル: AuthController.cs プロジェクト: ItSerzh/GoodNews
 public AuthController(IUserService userService, IRoleService roleService, IJwtAuthManager jwtAuthManager, IRefreshTokenService refreshTokenService)
 {
     _userService         = userService;
     _roleService         = roleService;
     _jwtAuthManager      = jwtAuthManager;
     _refreshTokenService = refreshTokenService;
 }
コード例 #5
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ICustomTokenResponseGenerator customResponseGenerator)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _customResponseGenerator = customResponseGenerator;
 }
コード例 #6
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ICustomTokenResponseGenerator customResponseGenerator)
 {
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _customResponseGenerator = customResponseGenerator;
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultRefreshTokenService" /> class.
 /// </summary>
 public ServerSideSessionRefreshTokenService(
     Decorator <IRefreshTokenService> inner,
     ISessionCoordinationService sessionCoordinationService)
 {
     Inner = inner.Instance;
     SessionCoordinationService = sessionCoordinationService;
 }
コード例 #8
0
        public async Task CreateAsync(AuthenticationTokenCreateContext context)
        {
            var refreshTokenId = Guid.NewGuid().ToString("n");

            if (context.Ticket == null)
            {
                context.Response.StatusCode   = 400;
                context.Response.ContentType  = "application/json";
                context.Response.ReasonPhrase = "invalid refresh token";
                return;
            }

            IRefreshTokenService refreshTokenService = ResolverFactory.GetService <RefreshTokenService>();

            var client = context.OwinContext.Get <Client>("oauth:client");

            var token = new RefreshTokenDto()
            {
                RefreshTokenId = UnitHelper.GetHash(refreshTokenId),
                Subject        = context.Ticket.Identity.Name,
                IssuedUtc      = DateTime.UtcNow,
                ExpiresUtc     = DateTime.UtcNow.AddDays(client.RefreshTokenLifeTime)
            };

            context.Ticket.Properties.IssuedUtc = token.IssuedUtc;

            context.Ticket.Properties.ExpiresUtc = token.ExpiresUtc;

            token.ProtectedTicket = context.SerializeTicket();

            await refreshTokenService.CreateAsync(token);

            context.SetToken(refreshTokenId);
        }
コード例 #9
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ILoggerFactory loggerFactory)
 {
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _logger = loggerFactory.CreateLogger <TokenResponseGenerator>();
 }
コード例 #10
0
 public AccountController(
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IHttpContextAccessor httpContextAccessor,
     IAuthenticationSchemeProvider schemeProvider,
     IEventService events,
     IRefreshTokenService refreshTokenService,
     ITokenService tokenService,
     IUserClaimsPrincipalFactory <IdentityUser <int> > principalFactory,
     IdentityServerOptions options,
     SignInManager <IdentityUser <int> > signInManager,
     UserManager <IdentityUser <int> > userManager,
     TokenHandlerService tokenHandler,
     AppDbContext context)
 {
     // if the TestUserStore is not in DI, then we'll just use the global users collection
     _context          = context;
     _interaction      = interaction;
     _events           = events;
     _account          = new AccountService(interaction, httpContextAccessor, schemeProvider, clientStore);
     _principalFactory = principalFactory;
     _options          = options;
     _signInManager    = signInManager;
     _userManager      = userManager;
     _tokenHandler     = tokenHandler;
 }
コード例 #11
0
 public UsersController(
     IAuthenticateService authenticateService,
     IRefreshTokenService refreshTokenService)
 {
     this.authenticateService = authenticateService;
     this.refreshTokenService = refreshTokenService;
 }
コード例 #12
0
        public TokenValidator(
            IdentityServerOptions options,
            IHttpContextAccessor context,
            IClientStore clients,
            IProfileService profile,
            IReferenceTokenStore referenceTokenStore,
            IRefreshTokenService refreshTokenService,
            ICustomTokenValidator customValidator,
            IKeyMaterialService keys,
            ISystemClock clock,
            ILogger <TokenValidator> logger)
        {
            _options             = options;
            _context             = context;
            _clients             = clients;
            _profile             = profile;
            _referenceTokenStore = referenceTokenStore;
            _refreshTokenService = refreshTokenService;
            _customValidator     = customValidator;
            _keys   = keys;
            _clock  = clock;
            _logger = logger;

            _log = new TokenValidationLog();
        }
コード例 #13
0
 public RefreshTokenQueryHandler(IRefreshTokenService service, ICommonService commonService,
                                 IUnitOfWork unitOfWork)
 {
     _service       = service;
     _commonService = commonService;
     _unitOfWork    = unitOfWork;
 }
コード例 #14
0
 public TokenRequestValidator(
     IdentityServerOptions options,
     IIssuerNameService issuerNameService,
     IAuthorizationCodeStore authorizationCodeStore,
     IResourceOwnerPasswordValidator resourceOwnerValidator,
     IProfileService profile,
     IDeviceCodeValidator deviceCodeValidator,
     IBackchannelAuthenticationRequestIdValidator backchannelAuthenticationRequestIdValidator,
     ExtensionGrantValidator extensionGrantValidator,
     ICustomTokenRequestValidator customRequestValidator,
     IResourceValidator resourceValidator,
     IResourceStore resourceStore,
     IRefreshTokenService refreshTokenService,
     IEventService events,
     ISystemClock clock,
     ILogger <TokenRequestValidator> logger)
 {
     _logger                 = logger;
     _options                = options;
     _issuerNameService      = issuerNameService;
     _clock                  = clock;
     _authorizationCodeStore = authorizationCodeStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile                = profile;
     _deviceCodeValidator    = deviceCodeValidator;
     _backchannelAuthenticationRequestIdValidator = backchannelAuthenticationRequestIdValidator;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _resourceValidator       = resourceValidator;
     _resourceStore           = resourceStore;
     _refreshTokenService     = refreshTokenService;
     _events = events;
 }
コード例 #15
0
        public async Task CreateAsync(AuthenticationTokenCreateContext context)
        {
            var container = new UnityContainer();

            container.RegisterType <IRefreshTokenDataSource, RefreshTokenDataSource>();
            container.RegisterType <IRefreshTokenService, RefreshTokenService>();
            IRefreshTokenService _refreshTokenService = container.Resolve <IRefreshTokenService>();

            var refreshTokenLifeTime = context.OwinContext.Get <string>("clientRefreshTokenLifeTime") ?? "60";

            var token = new FM.Portal.Core.Model.RefreshToken()
            {
                ID         = Guid.NewGuid(),
                UserID     = Guid.Parse(context.Ticket.Identity.GetUserId()),
                IssuedDate = DateTime.UtcNow,
                ExpireDate = DateTime.UtcNow.AddMinutes(Convert.ToDouble(refreshTokenLifeTime))
            };

            context.Ticket.Properties.IssuedUtc  = token.IssuedDate;
            context.Ticket.Properties.ExpiresUtc = token.ExpireDate;

            token.ProtectedTicket = context.SerializeTicket();

            var result = _refreshTokenService.Add(token);

            if (result.Success)
            {
                context.SetToken(token.ID.ToString("n"));
            }
        }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenRequestValidator" /> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="resourceOwnerValidator">The resource owner validator.</param>
 /// <param name="profile">The profile.</param>
 /// <param name="deviceCodeValidator">The device code validator.</param>
 /// <param name="extensionGrantValidator">The extension grant validator.</param>
 /// <param name="customRequestValidator">The custom request validator.</param>
 /// <param name="resourceValidator">The resource validator.</param>
 /// <param name="resourceStore">The resource store.</param>
 /// <param name="refreshTokenService"></param>
 /// <param name="events">The events.</param>
 /// <param name="clock">The clock.</param>
 /// <param name="logger">The logger.</param>
 public TokenRequestValidator(IdentityServerOptions options,
                              IAuthorizationCodeStore authorizationCodeStore,
                              IResourceOwnerPasswordValidator resourceOwnerValidator,
                              IProfileService profile,
                              IDeviceCodeValidator deviceCodeValidator,
                              ExtensionGrantValidator extensionGrantValidator,
                              ICustomTokenRequestValidator customRequestValidator,
                              IResourceValidator resourceValidator,
                              IResourceStore resourceStore,
                              IRefreshTokenService refreshTokenService,
                              IEventService events,
                              ISystemClock clock,
                              ILogger <TokenRequestValidator> logger)
 {
     _logger  = logger;
     _options = options;
     _clock   = clock;
     _authorizationCodeStore = authorizationCodeStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile                 = profile ?? throw new ArgumentNullException(nameof(profile));
     _deviceCodeValidator     = deviceCodeValidator;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _resourceValidator       = resourceValidator;
     _resourceStore           = resourceStore;
     _events = events ?? throw new ArgumentNullException(nameof(events));
     _refreshTokenService = refreshTokenService ?? throw new ArgumentNullException(nameof(refreshTokenService));
 }
コード例 #17
0
 public AuthMiddleware(
     IWorkContextAccessor workContextAccessor,
     IRefreshTokenService refreshTokenService)
 {
     _workContextAccessor = workContextAccessor;
     _refreshTokenService = refreshTokenService;
 }
コード例 #18
0
 public TokensController(IDispatcher dispatcher, IRefreshTokenService refreshTokenService,
                         IMemoryCache cache)
     : base(dispatcher)
 {
     _refreshTokenService = refreshTokenService;
     _cache = cache;
 }
コード例 #19
0
ファイル: AuthService.cs プロジェクト: Fogolan/OrchardForWork
 public AuthService(
     IRefreshTokenService refreshTokenService,
     IHttpContextAccessor httpContextAccessor)
 {
     _refreshTokenService = refreshTokenService;
     _owinContext         = httpContextAccessor.Current().GetOwinContext();
 }
コード例 #20
0
ファイル: TokensController.cs プロジェクト: jcambert/WeErp
 public TokensController(IAccessTokenService accessTokenService,
                         IRefreshTokenService refreshTokenService,
                         IDispatcher dispatcher,
                         IConfiguration configuration,
                         IOptions <AppOptions> appOptions) :
     base(accessTokenService, refreshTokenService, dispatcher, configuration, appOptions)
 {
 }
コード例 #21
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IResourceStore resources, IClientStore clients, ILoggerFactory loggerFactory)
 {
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
     _resources           = resources;
     _clients             = clients;
     _logger = loggerFactory.CreateLogger <TokenResponseGenerator>();
 }
コード例 #22
0
 public RefreshTokenProvider(IRefreshTokenService refreshTokenService, ICommandBus commandBus, int refreshTokenExpiredTimeInMinutes, int ttlChange)
 {
     this.refreshTokenService = refreshTokenService;
     this.commandBus = commandBus;
     this.expriredTime = refreshTokenExpiredTimeInMinutes;
     this.ttlChange = ttlChange;
     this.serializer = new TicketSerializer();
 }
コード例 #23
0
ファイル: CachedHttpClient.cs プロジェクト: Softeq/XToolkit
 protected CachedHttpClient(
     IJsonSerializer jsonSerializer,
     IRefreshTokenService refreshTokenService,
     ILogManager logManager,
     ICache localCache) : base(jsonSerializer, refreshTokenService, logManager)
 {
     _localCache = localCache;
 }
コード例 #24
0
 public RefreshTokenProvider(IRefreshTokenService refreshTokenService, ICommandBus commandBus, int refreshTokenExpiredTimeInMinutes, int ttlChange)
 {
     this.refreshTokenService = refreshTokenService;
     this.commandBus          = commandBus;
     this.expriredTime        = refreshTokenExpiredTimeInMinutes;
     this.ttlChange           = ttlChange;
     this.serializer          = new TicketSerializer();
 }
コード例 #25
0
 public RefreshAccessTokenCommandHandler(IHttpContextAccessor httpContextAccessor,
                                         IRefreshTokenService refreshTokenService, IOptions <JwtConfig> jwtConfigOptions)
 {
     _httpContext = httpContextAccessor.HttpContext ??
                    throw new ArgumentNullException(nameof(httpContextAccessor.HttpContext));
     _refreshTokenService = refreshTokenService ?? throw new ArgumentNullException(nameof(refreshTokenService));
     _jwtConfig           = jwtConfigOptions.Value ?? throw new ArgumentNullException(nameof(jwtConfigOptions.Value));
 }
コード例 #26
0
 public AuthTokenService(IAccessTokenService accessTokenService,
                         IRefreshTokenService refreshTokenService,
                         ICustomerManager clientManager)
 {
     this.accessTokenService  = accessTokenService;
     this.refreshTokenService = refreshTokenService;
     this.clientManager       = clientManager;
 }
コード例 #27
0
 public AuthService(UserManager userManager, IRefreshTokenService refreshTokenService, IJwtFactory jwtFactory, IJwtTokenValidator jwtTokenValidator, JwtIssuerOptions jwtIssuerOptions)
 {
     _userManager         = userManager;
     _refreshTokenService = refreshTokenService;
     _jwtFactory          = jwtFactory;
     _jwtTokenValidator   = jwtTokenValidator;
     _jwtIssuerOptions    = jwtIssuerOptions;
 }
コード例 #28
0
 public UserService(IUserLoginService userLoginService, IOptions <AppSettings> appSettings, IEmployeeService employeeService, IRefreshTokenService refreshTokenService, IRevokeTokenService revokeTokenService)
 {
     _userLoginService    = userLoginService;
     _employeeService     = employeeService;
     _refreshTokenService = refreshTokenService;
     _revokeTokenService  = revokeTokenService;
     _appSettings         = appSettings.Value;
 }
コード例 #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenResponseGenerator" /> class.
 /// </summary>
 /// <param name="tokenService">The token service.</param>
 /// <param name="refreshTokenService">The refresh token service.</param>
 /// <param name="resources">The resources.</param>
 /// <param name="clients">The clients.</param>
 /// <param name="logger">The logger.</param>
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IResourceStore resources, IClientStore clients, ILogger <TokenResponseGenerator> logger)
 {
     TokenService        = tokenService;
     RefreshTokenService = refreshTokenService;
     Resources           = resources;
     Clients             = clients;
     Logger = logger;
 }
コード例 #30
0
 public AuthenticationService(IUserRepository userRepository, IPasswordHasher <User> passwordHasher,
                              ITokenService tokenService, IRefreshTokenService refreshTokenService)
 {
     _userRepository      = userRepository;
     _passwordHasher      = passwordHasher;
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
 }
コード例 #31
0
 public TokenController(IAccessTokenDecoder accessTokenDecoder, IRefreshTokenDecoder refreshTokenDecoder,
                        IRefreshTokenService refreshTokenService, IMediator mediator)
 {
     _accessTokenDecoder  = accessTokenDecoder ?? throw new ArgumentNullException(nameof(accessTokenDecoder));
     _refreshTokenDecoder = refreshTokenDecoder ?? throw new ArgumentNullException(nameof(refreshTokenDecoder));
     _refreshTokenService = refreshTokenService ?? throw new ArgumentNullException(nameof(refreshTokenService));
     _mediator            = mediator ?? throw new ArgumentNullException(nameof(mediator));
 }
コード例 #32
0
 public UsersController(MovieRamaContext dbContext, IHashingService hashingService, IJwtService jwtService, IRefreshTokenService refreshTokenService, AuthenticationService authService)
 {
     _dbContext           = dbContext;
     _hashingService      = hashingService;
     _jwtService          = jwtService;
     _refreshTokenService = refreshTokenService;
     _authService         = authService;
 }
コード例 #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenResponseGenerator" /> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="tokenService">The token service.</param>
 /// <param name="refreshTokenService">The refresh token service.</param>
 /// <param name="resources">The resources.</param>
 /// <param name="clients">The clients.</param>
 /// <param name="logger">The logger.</param>
 public TokenResponseGenerator(IdentityServerOptions options, ITokenService tokenService, IRefreshTokenService refreshTokenService, IResourceStore resources, IClientStore clients, ILogger <TokenResponseGenerator> logger)
 {
     Options             = options;
     TokenService        = tokenService;
     RefreshTokenService = refreshTokenService;
     Resources           = resources;
     Clients             = clients;
     Logger = logger;
 }
コード例 #34
0
 protected RestHttpClientBase(
     IJsonSerializer jsonSerializer,
     IRefreshTokenService refreshTokenService,
     ILogManager logManager)
 {
     JsonSerializer       = jsonSerializer;
     _refreshTokenService = refreshTokenService;
     Logger = logManager.GetLogger(GetType().ToString());
 }
コード例 #35
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
 }
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
 }