コード例 #1
0
 public Handler(IDbContext context,
                IDbContext db,
                ITokenGenerator tokenGenerator) : base(context)
 {
     _db             = db;
     _tokenGenerator = tokenGenerator;
 }
コード例 #2
0
 public LoginController(ITokenGenerator _tokenGenerator, IPasswordHasher _passwordHasher,
                        IUserDAO userDAO)
 {
     tokenGenerator = _tokenGenerator;
     passwordHasher = _passwordHasher;
     this.userDAO   = userDAO;
 }
コード例 #3
0
 public LoginController(
     UserManager <AppUserModel> userManager,
     ITokenGenerator tokenGenerator)
 {
     _userManager    = userManager;
     _tokenGenerator = tokenGenerator;
 }
コード例 #4
0
 public CacheableTokenProvider(ITokenStorage tokenStorage, ITokenGenerator tokenGenerator, ITokenMetadataCacheStrategy tokenMetadataCacheStrategy)
 {
     _tokenMetadataCacheStrategy = tokenMetadataCacheStrategy;
     _cache     = new InMemoryTokenStorage();
     _generator = tokenGenerator;
     _storage   = tokenStorage;
 }
コード例 #5
0
        public static ITokenGenerator Build(ILifetimeScope requestContainer, NancyContext context)
        {
            ITokenGenerator tokenGenerator = null;

            if (context.Request != null &&
                context.Request.Headers[ACCEPT_TOKEN_ALGORITHM_HEADER] != null &&
                context.Request.Headers[ACCEPT_TOKEN_ALGORITHM_HEADER].Contains(SecurityAlgorithms.RsaSha256))
            {
                tokenGenerator = requestContainer.ResolveKeyed <ITokenGenerator>(SecurityAlgorithms.RsaSha256);
            }
            else
            {
                var settings = requestContainer.Resolve <TokenGeneratorSettings>();
                if (string.IsNullOrWhiteSpace(settings.Alg))
                {
                    tokenGenerator = requestContainer.ResolveKeyed <ITokenGenerator>(SecurityAlgorithms.HmacSha256);
                }
                else
                {
                    tokenGenerator = requestContainer.ResolveKeyed <ITokenGenerator>(settings.Alg);
                }
            }

            return(tokenGenerator);
        }
コード例 #6
0
 public AuthService(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, ITokenGenerator tokenGenerator, IMapper mapper)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _tokenGenerator = tokenGenerator;
     _mapper         = mapper;
 }
コード例 #7
0
        public TokenGeneratorTests()
        {
            _appSettings = new AppSettings
            {
                Secret            = "STRINGU ALA BLANAOSSTRINGU ALA BLANAOS BLANAOSSTRINGU ALA BLANAOS BLANAOSSTRINGU ALA BLANAOS BLANAOSSTRINGU ALA BLANAOS",
                TokenLifetimeDays = 7
            };
            _tokenGenerator = new TokenGenerator();
            User            = new UserTokenDataModel
            {
                Id          = 1,
                DisplayName = "testttt",
                Email       = "*****@*****.**",
                UserRole    = UserRole.Admin.ToString()
            };

            Token = _tokenGenerator.Generate(_appSettings, User);

            Key = Encoding.ASCII.GetBytes(_appSettings.Secret);

            Validations = new TokenValidationParameters
            {
                ValidateIssuerSigningKey = true,
                IssuerSigningKey         = new SymmetricSecurityKey(Key),
                ValidateIssuer           = false,
                ValidateAudience         = false
            };
            Handler = new JwtSecurityTokenHandler();
        }
コード例 #8
0
 public LoginUserHandler(IRead <UserDirectory> userDirectoryReader, ITokenGenerator tokenGenerator, IJWTService jwtService, PasswordService passwordService)
 {
     _userDirectoryReader = userDirectoryReader;
     _passwordService     = passwordService;
     _tokenGenerator      = tokenGenerator;
     _jwtService          = jwtService;
 }
コード例 #9
0
 public Handler(UserManager <AppUser> userManager, IRoleAccessor roleAccessor, ITokenGenerator tokenGenerator, IUserAccessor userAccessor)
 {
     this.roleAccessor   = roleAccessor;
     this.userManager    = userManager;
     this.tokenGenerator = tokenGenerator;
     this.userAccessor   = userAccessor;
 }
コード例 #10
0
        public DefaultAuthServer(
            IClientValidator clientValidator
            , ITokenGenerator tokenGenerator
            , IAuthCodeStore authCodeStore
            , ITokenInfoStore tokenStore
            , IStateStore stateStore
            , IAuthCodeGenerator authCodeGenerator
            , IResourceOwnerValidator resourceOwnerValidator
            , ILogger <DefaultAuthServer> logger
            , AuthServerOptions options
            , IPkceValidator pkceValidator
            , IConfiguration configuration
            )
        {
            _clientValidator        = clientValidator;
            _tokenGenerator         = tokenGenerator;
            _resourceOwnerValidator = resourceOwnerValidator;
            _logger            = logger;
            _authCodeStore     = authCodeStore;
            _tokenStore        = tokenStore;
            _stateStore        = stateStore;
            _authCodeGenerator = authCodeGenerator;
            _pkceValidator     = pkceValidator;
            _configuration     = configuration;

            TokenRequestHandler      = HandleTokenRequestAsync;
            AuthorizeRequestHandler  = HandleAuthorizeRequestAsync;
            EndSessionRequestHandler = HandleEndSessionRequestAsync;
            ClearTokenRequestHandler = HandleClearTokenRequestAsync;
            AuthServerOptions        = options;
        }
コード例 #11
0
 public AuthenticateHandler(IResponse response, IMapper mapper, ILoginContext loginContext, ITokenGenerator tokenGenerator)
 {
     this.response       = response;
     this.mapper         = mapper;
     this.loginContext   = loginContext;
     this.tokenGenerator = tokenGenerator;
 }
コード例 #12
0
 public LoginService(IUnitOfWork unitOfWork, IMapper mapper, ITokenGenerator tokenGenerator, IOptions <Configuration> options)
 {
     this.unitOfWork     = unitOfWork;
     this.mapper         = mapper;
     this.tokenGenerator = tokenGenerator;
     this.options        = options;
 }
コード例 #13
0
 public OAuthController(SignInManager <IdentityUser> signInManager, DataContext dataContext,
                        ITokenGenerator tokenGenerator)
 {
     this.signInManager  = signInManager;
     this.dataContext    = dataContext;
     this.tokenGenerator = tokenGenerator;
 }
コード例 #14
0
 public TokenGeneratorTests()
 {
     _tokenGenerator = new TokenGenerator(
         _configuration.Object,
         _logger.Object,
         _repositoryUser.Object);
 }
コード例 #15
0
 public InMemoryNavigationManager(ITokenGenerator tokenGenerator)
 {
     _items           = new ConcurrentDictionary <string, NavigationItem>();
     _expireditems    = new ConcurrentDictionary <string, NavigationItem>();
     _privateTokenMap = new ConcurrentDictionary <string, string>();
     _tokenGenerator  = tokenGenerator;
 }
コード例 #16
0
ファイル: UsersController.cs プロジェクト: cantte/Kaizen
 public UsersController(IApplicationUserRepository userRepository, IMapper mapper,
                        ITokenGenerator tokenGenerator)
 {
     _userRepository = userRepository;
     _mapper         = mapper;
     _tokenGenerator = tokenGenerator;
 }
コード例 #17
0
        public void SetUp()
        {
            this.knownUsers = new Dictionary<string, string>();
            this.tokenGenerator = A.Fake<ITokenGenerator>();

            this.testee = new LoginService(new UserAuthenticator(this.knownUsers, this.tokenGenerator));
        }
コード例 #18
0
 public CacheableTokenProvider(ITokenStorage tokenStorage, ITokenGenerator tokenGenerator, ITokenMetadataCacheStrategy tokenMetadataCacheStrategy)
 {
     _tokenMetadataCacheStrategy = tokenMetadataCacheStrategy;
     _cache = new InMemoryTokenStorage();
     _generator = tokenGenerator;
     _storage = tokenStorage;
 }
コード例 #19
0
 public LoginService(UserManager <User> userManager, SignInManager <User> signInManager, ITokenGenerator tokenGenerator, IChannelManager channelManager)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _tokenGenerator = tokenGenerator;
     _channelManager = channelManager;
 }
コード例 #20
0
 public UsersController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IMapper mapper, ITokenGenerator tokenGenerator)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _mapper         = mapper;
     _tokenGenerator = tokenGenerator;
 }
コード例 #21
0
        public void SetUp()
        {
            this.knownUsers     = new Dictionary <string, string>();
            this.tokenGenerator = A.Fake <ITokenGenerator>();

            this.testee = new LoginService(new UserAuthenticator(this.knownUsers, this.tokenGenerator));
        }
コード例 #22
0
 public LoginController(ITokenGenerator _tokenGenerator, IPasswordHasher _passwordHasher, IUserDAO _userDAO, ICollectionDAO _collectionDAO)
 {
     tokenGenerator = _tokenGenerator;
     passwordHasher = _passwordHasher;
     userDAO        = _userDAO;
     collectionDAO  = _collectionDAO;
 }
コード例 #23
0
 public TokenController(
     [NotNull] ILogger <TokenController> logger,
     [NotNull] ITokenGenerator tokenGenerator)
 {
     this.logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tokenGenerator = tokenGenerator ?? throw new ArgumentNullException(nameof(tokenGenerator));
 }
コード例 #24
0
 public AssertionService(ILogger <AssertionService> logger, IDigitalSigner keyVault,
                         ITokenGenerator tokenGenerator)
 {
     _logger         = logger;
     _keyVault       = keyVault;
     _tokenGenerator = tokenGenerator;
 }
コード例 #25
0
ファイル: TokenController.cs プロジェクト: j-re/vuedotnet
 public TokenController(VueContext db, SignInManager <AppUser> signInManager, UserManager <AppUser> userManager, ITokenGenerator tokenGenerator)
 {
     _signInManager  = signInManager;
     _userManager    = userManager;
     _tokenGenerator = tokenGenerator;
     _db             = db;
 }
コード例 #26
0
 public SimpleDiscoveryDelegatingHandler(ITokenGenerator tokenGenerator
                                         , IMemoryCache memoryCache)
 {
     this.ContextId  = Guid.NewGuid();
     _tokenGenerator = tokenGenerator;
     _memoryCache    = memoryCache;
 }
コード例 #27
0
 public LoginController(IContractorAccountRepository ContractorAccountRepository,
                        ITokenGenerator TokenGenerator)
 {
     DbContext = new DissertationContext();
     this.ContractorAccountRepository = new ContractorAccountRepository(DbContext);
     this.TokenGenerator = TokenGenerator;
 }
コード例 #28
0
        public TokenGenerator()
        {
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            _tokenHandler   = fixture.Create <Mock <JwtSecurityTokenHandler> >();
            _tokenGenerator = new Infrastructure.TokenGenerator(_tokenHandler.Object);
        }
コード例 #29
0
 public TokenCreationService(ISystemClock clock, IKeyMaterialService keys, ILogger <TokenCreationService> logger, ITokenGenerator tokenGenerator)
 {
     Clock           = clock;
     Keys            = keys;
     Logger          = logger;
     _tokenGenerator = tokenGenerator;
 }
コード例 #30
0
 public UpdateUserCommandHandler(UserManager <AuthUser> userManager, ITokenGenerator tokenGenerator, IUserManagementService userManagementService, ApplicationDbContext dbContext)
 {
     _userManager           = userManager;
     _tokenGenerator        = tokenGenerator;
     _userManagementService = userManagementService;
     _dbContext             = dbContext;
 }
コード例 #31
0
 public AuthController(IConfiguration configuration, ITokenGenerator tokenGenerator, IMapper mapper, IUserService userService)
 {
     _mapper         = mapper;
     _configuration  = configuration;
     _tokenGenerator = tokenGenerator;
     _userService    = userService;
 }
コード例 #32
0
 public UserService(UserManager <User> userManager, IUserDtoValidator userDtoValidator,
                    SignInManager <User> signInManager, ITokenGenerator tokenGenerator)
 {
     _userManager      = userManager;
     _userDtoValidator = userDtoValidator;
     _signInManager    = signInManager;
     _tokenGenerator   = tokenGenerator;
 }
コード例 #33
0
 public UserSessionFactory(IWriteableRepository writeableRepository,
                           ITimeProvider timeProvider,
                           ITokenGenerator<Guid> tokenGenerator,
                           ITokenExpirationProvider tokenExpirationProvider)
 {
     _writeableRepository = writeableRepository;
     _timeProvider = timeProvider;
     _tokenGenerator = tokenGenerator;
     _tokenExpirationProvider = tokenExpirationProvider;
 }
コード例 #34
0
ファイル: AntiForgeryWorker.cs プロジェクト: Nakro/Mvc
 internal AntiForgeryWorker([NotNull] IAntiForgeryTokenSerializer serializer,
                            [NotNull] AntiForgeryOptions config,
                            [NotNull] ITokenStore tokenStore,
                            [NotNull] ITokenGenerator generator,
                            [NotNull] ITokenValidator validator)
 {
     _serializer = serializer;
     _config = config;
     _tokenStore = tokenStore;
     _generator = generator;
     _validator = validator;
 }
コード例 #35
0
 public UserAuthenticator(IDictionary<string, string> knownUsers, ITokenGenerator tokenGenerator)
 {
     this.knownUsers = knownUsers;
     this.tokenGenerator = tokenGenerator;
 }
コード例 #36
0
 public CacheableTokenProvider(ITokenStorage tokenStorage, ITokenGenerator tokenGenerator)
     : this(tokenStorage, tokenGenerator, new TokenCacheStrategy())
 {
 }
コード例 #37
0
ファイル: OAuthProvider.cs プロジェクト: deveel/cloudb-oauth
        protected virtual void Configure(ConfigSource config)
        {
            tokenStore = (ITokenStore)ConfigureComponent(config.GetChild("tokenStore"), typeof(ITokenStore), typeof(HeapTokenStore));
            callbackStore = (ICallbackStore)ConfigureComponent(config.GetChild("callbackStore"), typeof(ICallbackStore), typeof(HeapCallbackStore));
            consumerStore = (IConsumerStore)ConfigureComponent(config.GetChild("consumerStore"), typeof(IConsumerStore), typeof(HeapConsumerStore));
            requestIdValidator = (IRequestIdValidator)ConfigureComponent(config.GetChild("requestIdValidator"), typeof(IRequestIdValidator), typeof(HeapRequestIdValidator));
            resourceAccessVerifier = (IResourceAccessVerifier)ConfigureComponent(config.GetChild("resourceAccessVerifier"), typeof(IResourceAccessVerifier), null);
            tokenGenerator = (ITokenGenerator)ConfigureComponent(config.GetChild("tokenGenerator"), typeof(ITokenGenerator), typeof(GuidTokenGenerator));
            verificationProvider = (IVerificationProvider)ConfigureComponent(config.GetChild("verificationProvider"), typeof(IVerificationProvider), typeof(MD5HashVerificationProvider));

            allowOutOfBandCallback = config.GetBoolean("oobCallback");
        }
コード例 #38
0
 public TokenController(ITokenGenerator tokenGenerator)
 {
     _tokenGenerator = tokenGenerator;
 }