public PasswordGrantController(IAccessTokenService accessTokenService, IUserApplicationService userApplicationService, IUserService userService) { _accessTokenService = accessTokenService; _userApplicationService = userApplicationService; _userService = userService; }
public UserController() { TicketsContext context = new TicketsContext(); _userService = new UserService(new UserRepository(context)); _tokenService = new AccessTokenService(new AccessTokenRepository(context)); _userMapper = new UserMapper(); }
public MemberController(IBaseApiManager BaseApiManager, IAccountService AccountService, IAccessTokenService AccessTokenService) : base(BaseApiManager) { this.BaseApiManager = BaseApiManager; this.AccountService = AccountService; this.AccessTokenService = AccessTokenService; }
public async Task <string> GetAccessToken() { IAccessTokenService accessTokenService = _sp.GetService <IAccessTokenService>(); var result = await accessTokenService.GetToken(Config.AppId, Config.AppSecret); return(result.access_token); }
private NrpsClient(string keyVaultKeyString, IHttpClientFactory httpClientFactory, IAccessTokenService accessTokenService, ILogger logger) { _keyVaultKeyString = keyVaultKeyString; _httpClientFactory = httpClientFactory; _accessTokenService = accessTokenService; _logger = logger; }
public LoginController(IAccessTokenService accessTokenService, ISetupUser setupUser, ILog log, IStoreService storeService) { _accessTokenService = accessTokenService; _setupUser = setupUser; _log = log; _storeService = storeService; }
public async Task Invoke(HttpContext context, IAccessTokenService accessTokenService, IUserApplicationService userApplicationService) { string accessCode; bool hasCookie = context.Request.Cookies.TryGetValue("_oidc.core-token", out accessCode); if (!hasCookie) { accessCode = context.Request.Headers .FirstOrDefault(x => x.Key.Equals("Authorization")) .Value; } if (accessCode != null) { await AttachUserToContext( context, accessCode.Replace("Bearer ", ""), accessTokenService, userApplicationService ); } await _next(context); }
private async Task AttachUserToContext(HttpContext context, string accessCode, IAccessTokenService accessTokenService, IUserApplicationService userApplicationService) { AccessToken accessToken = await accessTokenService.FindByCodeAsync(accessCode); if (accessToken.Revoked || DateTime.Now > accessToken.ExpiresAt) { return; } context.Items["User"] = accessToken.User; context.Items["Application"] = accessToken.Application; if (accessToken.Application != null) { List <Scope> scopes = new List <Scope>(); UserApplication userApplication = await userApplicationService.FindByUserAndApplicationAsync(accessToken.User, accessToken.Application); if (userApplication == null) { return; } foreach (UserApplicationScope scope in userApplication.Scopes) { scopes.Add(scope.Scope); } context.Items["Scopes"] = scopes; } }
public AuthController(IAuthService authService, IAccessTokenService accessTokenService, IMailService mailService, ISmsService smsService) { m_auth_service = authService; m_token_service = accessTokenService; m_mail_service = mailService; m_sms_service = smsService; }
/// <summary> /// Initializes a new instance of the <see cref="RegistryService"/> class. /// </summary> /// <param name="registryConfigurationOptions">The registry configuration options.</param> /// <param name="messageSerializer">The message serializer.</param> /// <param name="serviceMessageProcessor">The service message processor.</param> /// <param name="messageToServiceMapper">The message to service mapper.</param> /// <param name="messageTypeCache">The message type cache.</param> /// <param name="accessTokenService">The access token service.</param> /// <param name="registryServiceLogger">The registry service logger.</param> /// <param name="tcpNetworkConnectorLogger">The tcp network connector logger.</param> /// <param name="registryServiceMessageProcessorLogger">The registry service message processor logger.</param> /// <param name="httpNetworkConnectorLogger">The http network connector logger.</param> public RegistryService( IOptions <RegistryConfiguration> registryConfigurationOptions, IMessageSerializer messageSerializer, IServiceMessageProcessor serviceMessageProcessor, IMessageToServiceMapper messageToServiceMapper, IRegistryServiceMessageTypeCache messageTypeCache, IAccessTokenService accessTokenService, ILogger <RegistryService> registryServiceLogger, ILogger <TcpNetworkConnector> tcpNetworkConnectorLogger, ILogger <RegistryServiceMessageProcessor> registryServiceMessageProcessorLogger, ILogger <HttpNetworkConnector> httpNetworkConnectorLogger) { _messageSerializer = messageSerializer; _serviceMessageProcessor = serviceMessageProcessor; _registryServiceMessageProcessor = new RegistryServiceMessageProcessor(this, registryServiceMessageProcessorLogger); _messageToServiceMapper = messageToServiceMapper; RegistryConfiguration registryConfiguration = registryConfigurationOptions.Value; _tcpListener = new TcpListener(IPAddress.Any, registryConfiguration.Port); _messageTypeCache = messageTypeCache; _accessTokenService = accessTokenService; _registryServiceLogger = registryServiceLogger; _tcpNetworkConnectorLogger = tcpNetworkConnectorLogger; _httpNetworkConnectorLogger = httpNetworkConnectorLogger; }
public SendAcknowledgmentCommandHandler( IHubConnectionManager hubConnectionManager, IAccessTokenService accessTokenService) { this.hubConnectionManager = hubConnectionManager; this.accessTokenService = accessTokenService; }
public ApiRecordManager(IHttpContextAccessor Accessor, IInterfaceAccountService InterfaceAccountService, IInterfaceAccessTokenService InterfaceAccessTokenService, IAccessTokenService AccessTokenService, IWebApiAccessRecordService SysWebApiAccessRecordService) { this.Accessor = Accessor; this.InterfaceAccountService = InterfaceAccountService; this.InterfaceAccessTokenService = InterfaceAccessTokenService; this.AccessTokenService = AccessTokenService; this.SysWebApiAccessRecordService = SysWebApiAccessRecordService; }
public AuthTokenService(IAccessTokenService accessTokenService, IRefreshTokenService refreshTokenService, ICustomerManager clientManager) { this.accessTokenService = accessTokenService; this.refreshTokenService = refreshTokenService; this.clientManager = clientManager; }
public LoginController(IQueryBus queryBus, ICommandBus commandBus, IAccessTokenService accessTokenService, ISha512Service sha512Service, IRandomStringGenerationService randomStringGenerationService) : base(queryBus, commandBus) { _accessTokenService = accessTokenService; _sha512Service = sha512Service; _randomStringGenerationService = randomStringGenerationService; }
public PublicLoginController(ISha512Service sha512Service, IUserManagementService userManagementService, IRandomStringService randomStringService, IAccessTokenService <UserAccessTokenPayload> accessTokenService) { _sha512Service = sha512Service; _userManagementService = userManagementService; _randomStringService = randomStringService; _accessTokenService = accessTokenService; }
/// <summary> /// Contrôleur avec un IAccessTokenService /// </summary> /// <param name="accessTokenService">Fournisseur de jeton d'authentification au Key Vault</param> public Vault(IAccessTokenService accessTokenService) { _vaultAddress = ConfigurationManager.AppSettings["keyvault.address"]; _memoryCache = MemoryCache.Default; _accessTokenService = accessTokenService; KeyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(_accessTokenService.GetAccessToken)); }
public async Task Test_GetToken() { IAccessTokenService accessTokenService = _sp.GetService <IAccessTokenService>(); var result = await accessTokenService.GetToken(Config.AppId, Config.AppSecret); Assert.IsNotNull(result); Assert.IsNotNull(result.access_token); }
public TokensController(IAccessTokenService accessTokenService, IRefreshTokenService refreshTokenService, IDispatcher dispatcher, IConfiguration configuration, IOptions <AppOptions> appOptions) : base(accessTokenService, refreshTokenService, dispatcher, configuration, appOptions) { }
public BaseApiManager(IApiRecordManager ApiRecordManager, IInterfaceAccountService InterfaceAccountService, IInterfaceAccessTokenService InterfaceAccessTokenService, IAccountService AccountService, IAccessTokenService AccessTokenService) { this.ApiRecordManager = ApiRecordManager; this.InterfaceAccountService = InterfaceAccountService; this.InterfaceAccessTokenService = InterfaceAccessTokenService; this.AccountService = AccountService; this.AccessTokenService = AccessTokenService; }
public UserAuthController(IAccountService accountService, ILoggerFactory loggerFactory, IAccessTokenService accessTokenService, UserManager <UserAccount> userManager, SignInManager <UserAccount> signInManager) { _accountService = accountService; _accessTokenService = accessTokenService; _logger = loggerFactory.CreateLogger <UserAuthController>(); _signInManager = signInManager; _userManager = userManager; }
public RequestController(IRequestService requestService, ICarService carService, IDriverService driverService, IAccessTokenService accessTokenService, IClientService clientService) { this._requestService = requestService; this._carService = carService; this._driverService = driverService; this._accessTokenService = accessTokenService; this._clientService = clientService; }
public PublicCmsLoginController(ISha512Service sha512Service, IRandomStringService randomStringService, IAccessTokenService <CmsUserAccessTokenPayload> accessTokenService, ICmsUserManagementService cmsUserManagementService) { _sha512Service = sha512Service; _randomStringService = randomStringService; _accessTokenService = accessTokenService; _cmsUserManagementService = cmsUserManagementService; }
/// <summary> /// Initializes a new instance of the <see cref="Logout"/> class. /// </summary> public Logout( IAccessTokenService accessTokenService, IBlobContainerClientProvider blobContainerClientProvider, IDocumentClientProvider documentClientProvider) { _accessTokenService = accessTokenService; _blobContainerClientProvider = blobContainerClientProvider; _documentClientProvider = documentClientProvider; }
public AccountController(ILoginVmValidationService loginVmValidationService , ILoginService loginService , IAccessTokenService accessTokenService , ILogger <AccountController> logger) { _loginVmValidationService = loginVmValidationService; _loginService = loginService; _accessTokenService = accessTokenService; _logger = logger; }
public UsersController(ILogger <UsersController> logger, IMapper mapper, IUserService userService, IAccessTokenService refreshTokenService, ILibraryRepository libraryRepository, IImageRepository imageRepository) { Logger = logger; Mapper = mapper; UserService = userService; AccessTokenService = refreshTokenService; LibraryRepository = libraryRepository; ImageRepository = imageRepository; }
public UserAuthController(IAccountService accountService, ILoggerFactory loggerFactory, IAccessTokenService accessTokenService, ILoggerService loggerService, INotificationService notificationService, UserManager <UserAccount> userManager, SignInManager <UserAccount> signInManager) { _accountService = accountService; _accessTokenService = accessTokenService; _notificationService = notificationService; _loggerService = loggerService.CreateLogger(this); _signInManager = signInManager; _userManager = userManager; }
public RefreshTokenCommandHandler( IUowGeneral uowGeneral, IAccessTokenService accessTokenService, RefreshTokenService refreshTokenService ) { _uowGeneral = uowGeneral; _accessTokenService = accessTokenService; _refreshTokenService = refreshTokenService; }
public AccessTokenServiceCache(OioIdwsClient client) { if (client == null) { throw new ArgumentNullException(nameof(client)); } _client = client; _tokenService = new AccessTokenService(_client.Settings); _cacheClockSkew = _client.Settings.CacheClockSkew; }
public BaseTokensController( IAccessTokenService accessTokenService, IRefreshTokenService refreshTokenService, IDispatcher dispatcher, IConfiguration configuration, IOptions <AppOptions> appOptions) : base(dispatcher, configuration, appOptions) { _accessTokenService = accessTokenService; _refreshTokenService = refreshTokenService; }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { for (TimeSpan waitTime = m_session_timeout; !stoppingToken.IsCancellationRequested; await Task.Delay(waitTime, stoppingToken)) { using (IServiceScope scope = m_provider.CreateScope()) { IAccessTokenService ts = scope.ServiceProvider.GetRequiredService <IAccessTokenService>(); await ts.ReleaseExpiredTokens(100); } } }
/// <summary>Ensure the user is in a specific role.</summary> public static Task EnsureRole(this IAccessTokenService accessTokenService, HttpRequestData req, UserRoles role) => accessTokenService .ValidateTokenAsync(req) .ContinueWith(task => { if (!task.Result.IsValid || (role & task.Result.UserRole) == 0) { throw new AccessViolationException("The provided user do not have access to the resource!"); } });
public AccessTokenController() { _tokenService = new AccessTokenService(new AccessTokenRepository(new TicketsContext())); }
public HubConnectionManager(IAccessTokenService accessTokenService, IBus bus, IMessagingLogger messagingLogger) { this.accessTokenService = accessTokenService; this.bus = bus; this.messagingLogger = messagingLogger; }