Пример #1
0
 public AuthenticationHub(IMediator mediator, ILogger logger, IMappingService mappingService,
                          IRequestDispatchingProxy requestDispatchingProxy, IOAuthClientService service,
                          IAuthenticationApi authenticationApi, IOAuthHelper oauthHelper = null)
     : base(mediator, logger, mappingService, requestDispatchingProxy, oauthHelper)
 {
     _service           = service;
     _authenticationApi = authenticationApi;
 }
Пример #2
0
 public OAuthTokenController(
     IOAuthClientService oAuthClientService,
     IOAuthRefreshTokenService oAuthRefreshTokenService,
     IOAuthAccessTokenService oAuthAccessTokenService,
     IOAuthUserProvider oAuthUserProvider,
     IOAuthRefreshTokenStorage oAuthRefreshTokenStorage)
 {
     _oAuthClientService       = oAuthClientService;
     _oAuthRefreshTokenService = oAuthRefreshTokenService;
     _oAuthAccessTokenService  = oAuthAccessTokenService;
     _oAuthUserProvider        = oAuthUserProvider;
     _oAuthRefreshTokenStorage = oAuthRefreshTokenStorage;
 }
Пример #3
0
 public ApiHandler(RequestDelegate next, ILogger logger, IDBService dbService, IRouting routing,
                   IHttpContextProxy httpContextProxy, IAssemblyLoader assemblyLoader, IServiceResolver serviceResolver, IResponseBuilder responseBuilder,
                   IApiGatewayService apiGatewayService, IInMemoryCacheService inMemoryCacheService, IOAuthClientService oAuthClientService)
 {
     _next                 = next;
     _routing              = routing;
     _dbService            = dbService;
     _httpContextProxy     = httpContextProxy;
     _assemblyLoader       = assemblyLoader;
     _serviceResolver      = serviceResolver;
     _logger               = logger;
     _responseBuilder      = responseBuilder;
     _apiGatewayService    = apiGatewayService;
     _inMemoryCacheService = inMemoryCacheService;
     _oAuthClientService   = oAuthClientService;
 }
Пример #4
0
        public AppAuthTokenHandler(IDBService dBService, ILogger logger, IEncryption encryption, IOAuthClientService oAuthClientService, ZNxtUserStore users, IInMemoryCacheService inMemoryCacheService, IApiGatewayService apiGateway)
        {
            _dBService            = dBService;
            _logger               = logger;
            _encryption           = encryption;
            _oAuthClientService   = oAuthClientService;
            _userService          = users;
            _inMemoryCacheService = inMemoryCacheService;
            _apiGateway           = apiGateway;

            var data = CommonUtility.GetAppConfigValue("AppTokenValidationDuration");

            if (!string.IsNullOrEmpty(data))
            {
                long duration;
                if (long.TryParse(data, out duration))
                {
                    AppTokenValidationDuration = duration;
                }
            }
        }
Пример #5
0
 private bool InitApp()
 {
     Application.ThreadException += Application_ThreadException;
     try {
         var serviceURl = ConfigurationManager.AppSettings.Get("serviceUrl");
         _app = new OAuthEntityApp(serviceURl);
         _app.Init();
         // Get IOAuthClientService and hook to it's Redirected event - to get notified when user hits "Allow"
         _service             = _app.GetService <IOAuthClientService>();
         _service.Redirected += OAuthClientService_Redirected;
         //Setup default encryption channel - we store OAuth data encrypted
         var cryptoKey   = ConfigurationManager.AppSettings.Get("CryptoKey");
         var encrService = _app.GetService <Vita.Modules.EncryptedData.IEncryptionService>();
         encrService.AddChannel(HexUtil.HexToByteArray(cryptoKey));
         //Connect to db
         var connString = ConfigurationManager.AppSettings.Get("MsSqlConnectionString");
         if (!CheckConnection(connString))
         {
             return(false);
         }
         var dbSettings = new DbSettings(new MsSqlDbDriver(), MsSqlDbDriver.DefaultMsSqlDbOptions, connString);
         _app.ConnectTo(dbSettings);
         //Start local web server to handle redirects back from OAuth server, after user approves access
         StartWebService(serviceURl);
         // Hook to global error log, to show exception when it happens in Redirect controller
         var errLog = _app.GetService <IErrorLogService>();
         errLog.ErrorLogged += ErrLog_ErrorLogged;
         //Just for ease of debugging this app, update servers definitions in database
         var session = OpenSession();
         Vita.Modules.OAuthClient.OAuthServers.CreateUpdatePopularServers(session);
         session.SaveChanges();
         return(true);
     } catch (Exception ex) {
         Log(ex.ToLogString());
         MessageBox.Show(ex.Message, "Error");
         return(false);
     }
 }
Пример #6
0
 public HomeController(IOAuthClientService oauthClientService)
 {
     _oauthClientService = oauthClientService;
 }
Пример #7
0
 private bool InitApp() {
   Application.ThreadException += Application_ThreadException;
   try {
     var serviceURl = ConfigurationManager.AppSettings.Get("serviceUrl");
     _app = new OAuthEntityApp(serviceURl);
     _app.Init();
     // Get IOAuthClientService and hook to it's Redirected event - to get notified when user hits "Allow"
     _service = _app.GetService<IOAuthClientService>();
     _service.Redirected += OAuthClientService_Redirected;
     //Setup default encryption channel - we store OAuth data encrypted
     var cryptoKey = ConfigurationManager.AppSettings.Get("CryptoKey");
     var encrService = _app.GetService<Vita.Modules.EncryptedData.IEncryptionService>();
     encrService.AddChannel(HexUtil.HexToByteArray(cryptoKey));
     //Connect to db
     var connString = ConfigurationManager.AppSettings.Get("MsSqlConnectionString");
     if(!CheckConnection(connString))
       return false; 
     var dbSettings = new DbSettings(new MsSqlDbDriver(), MsSqlDbDriver.DefaultMsSqlDbOptions, connString);
     _app.ConnectTo(dbSettings);
     //Start local web server to handle redirects back from OAuth server, after user approves access
     StartWebService(serviceURl);
     // Hook to global error log, to show exception when it happens in Redirect controller
     var errLog = _app.GetService<IErrorLogService>();
     errLog.ErrorLogged += ErrLog_ErrorLogged;
     //Just for ease of debugging this app, update servers definitions in database
     var session = OpenSession();
     Vita.Modules.OAuthClient.OAuthServers.CreateUpdatePopularServers(session);
     session.SaveChanges();
     return true;
   } catch(Exception ex) {
     Log(ex.ToLogString());
     MessageBox.Show(ex.Message, "Error");
     return false; 
   }
 }
Пример #8
0
 public AuthenticationController(IOAuthClientService service, IAuthenticationApi authenticationApi)
 {
     _service           = service;
     _authenticationApi = authenticationApi;
 }
Пример #9
0
 public ClientStore(IOAuthClientService oAuthClientService)
 {
     _oAuthClientService = oAuthClientService;
 }