Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="usersService"></param>
 /// <param name="currentUserService"></param>
 /// <param name="authService"></param>
 public CommonController(ApplicationDbContext context, IUsersService usersService, ICurrentUserService currentUserService, IGoogleAuthService authService)
 {
     this.context            = context;
     this.usersService       = usersService;
     this.currentUserService = currentUserService;
     this.authService        = authService;
 }
        public GoogleDriveService(IGoogleAuthService googleAuthService)
        {
            _googleAuthService = googleAuthService;

            _client = googleAuthService.CreateRestClient("https://www.googleapis.com/drive/v2/");
            _clientForUploads = googleAuthService.CreateRestClient("https://www.googleapis.com/upload/drive/v2/");
        }
Beispiel #3
0
        public MainModel(IGoogleAuthService googleAuthService, IStorageService storageService, ISystemTrayService systemTrayService)
        {
            _googleAuthService = googleAuthService;
            _storageService = storageService;
            _systemTrayService = systemTrayService;

            Load();
        }
 public AppEmailService(EmailAppManagerContext context,
                        IGmailApiService apiService,
                        IGoogleAuthService googleService)
 {
     this.context       = context ?? throw new ArgumentNullException(nameof(context));
     this.apiService    = apiService ?? throw new ArgumentNullException(nameof(apiService));
     this.googleService = googleService ?? throw new ArgumentNullException(nameof(googleService));
 }
Beispiel #5
0
 public AuthService(UserManager <AppUser> userManager, RoleManager <IdentityRole> roleManager, AppDbContext context, JwtSettings jwtSettings, IGoogleAuthService googleAuthService)
 {
     _userManager       = userManager;
     _roleManager       = roleManager;
     _context           = context;
     _jwtSettings       = jwtSettings;
     _googleAuthService = googleAuthService;
 }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fileServices"></param>
 /// <param name="googleAuthService"></param>
 /// <param name="usersService"></param>
 /// <param name="currentUserService"></param>
 /// <param name="userActionServices"></param>
 public FileController(IFileServices fileServices, IGoogleAuthService googleAuthService, IUsersService usersService, ICurrentUserService currentUserService, IUserActionServices userActionServices)
 {
     this.fileServices       = fileServices;
     this.googleAuthService  = googleAuthService;
     this.usersService       = usersService;
     this.currentUserService = currentUserService;
     this.userActionServices = userActionServices;
 }
 public GmailApiService(IHttpClientFactory factory,
                        IOptions <GmailApiUrlOptions> gmailOptions,
                        IGoogleAuthService gmailAuthService,
                        EmailAppManagerContext context)
 {
     this.factory          = factory ?? throw new ArgumentNullException(nameof(factory));
     this.gmailUrlOptions  = gmailOptions?.Value ?? throw new ArgumentNullException(nameof(gmailOptions));
     this.gmailAuthService = gmailAuthService ?? throw new ArgumentNullException(nameof(gmailAuthService));
     this.context          = context ?? throw new ArgumentNullException(nameof(context));
 }
 /// <summary>
 ///
 /// </summary>
 public ApplyInDayHandleController(IUsersService usersService, ICurrentUserService currentUserService, IUserActionServices userActionServices, IAuditStreamServices auditStreamServices, IGoogleAuthService googleAuthService, ApplicationDbContext context, IApplyInDayService applyService)
 {
     this.usersService        = usersService;
     this.currentUserService  = currentUserService;
     this.userActionServices  = userActionServices;
     this.auditStreamServices = auditStreamServices;
     this.googleAuthService   = googleAuthService;
     this.context             = context;
     this.applyService        = applyService;
 }
        public ExportToGDriveCommand(IGoogleAuthService authService, IEventAggregator eventAggregator)
        {
            AuthService = authService;

            eventAggregator.GetEvent <StringEvent>().Subscribe(
                (msg) => MessageBox.Show(msg),
                ThreadOption.PublisherThread,
                true,
                (x) => x.ToUpper().Contains("HI"));
        }
Beispiel #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="phyGradeServices"></param>
 /// <param name="gradeServices"></param>
 /// <param name="usersService"></param>
 /// <param name="googleAuthService"></param>
 /// <param name="userActionServices"></param>
 /// <param name="currentUserService"></param>
 /// <param name="context"></param>
 public GradeManagerController(IPhyGradeServices phyGradeServices, IGradeServices gradeServices, IUsersService usersService, IGoogleAuthService googleAuthService, IUserActionServices userActionServices, ICurrentUserService currentUserService, ApplicationDbContext context)
 {
     this.phyGradeServices   = phyGradeServices;
     this.gradeServices      = gradeServices;
     this.usersService       = usersService;
     this.googleAuthService  = googleAuthService;
     this.userActionServices = userActionServices;
     this.currentUserService = currentUserService;
     this.context            = context;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="applyAuditStreamServices"></param>
 /// <param name="context"></param>
 /// <param name="googleAuthService"></param>
 /// <param name="usersService"></param>
 /// <param name="currentUserService"></param>
 /// <param name="userActionServices"></param>
 /// <param name="companiesService"></param>
 public ApplyAuditStreamController(IApplyAuditStreamServices applyAuditStreamServices, ApplicationDbContext context, IGoogleAuthService googleAuthService, IUsersService usersService, ICurrentUserService currentUserService, IUserActionServices userActionServices, ICompaniesService companiesService)
 {
     this.applyAuditStreamServices = applyAuditStreamServices;
     this.context            = context;
     this.googleAuthService  = googleAuthService;
     this.usersService       = usersService;
     this.currentUserService = currentUserService;
     this.userActionServices = userActionServices;
     this.companiesService   = companiesService;
 }
Beispiel #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="authService"></param>
 /// <param name="usersService"></param>
 /// <param name="userActionServices"></param>
 /// <param name="companiesService"></param>
 /// <param name="statisrticsAppliesServices"></param>
 /// <param name="statisticsAppliesProcessServices"></param>
 /// <param name="statisticsDailyProcessServices"></param>
 public VacationStatisticsController(ApplicationDbContext context, IGoogleAuthService authService, IUsersService usersService, IUserActionServices userActionServices, ICompaniesService companiesService, IStatisrticsAppliesServices statisrticsAppliesServices, IStatisticsAppliesProcessServices statisticsAppliesProcessServices, IStatisticsDailyProcessServices statisticsDailyProcessServices)
 {
     this.context                          = context;
     this.authService                      = authService;
     this.usersService                     = usersService;
     _userActionServices                   = userActionServices;
     this.companiesService                 = companiesService;
     this.statisticsAppliesServices        = statisrticsAppliesServices;
     this.statisticsAppliesProcessServices = statisticsAppliesProcessServices;
     this.statisticsDailyProcessServices   = statisticsDailyProcessServices;
 }
 /// <summary>
 /// 用户管理
 /// </summary>
 /// <param name="env"></param>
 /// <param name="usersService"></param>
 /// <param name="currentUserService"></param>
 /// <param name="userServiceDetail"></param>
 /// <param name="companiesService"></param>
 /// <param name="applyService"></param>
 /// <param name="authService"></param>
 /// <param name="companyManagerServices"></param>
 /// <param name="userActionServices"></param>
 /// <param name="context"></param>
 public UsersController(IWebHostEnvironment env, IUsersService usersService, ICurrentUserService currentUserService, IUserServiceDetail userServiceDetail, ICompaniesService companiesService, IApplyVacationService applyService, IGoogleAuthService authService, ICompanyManagerServices companyManagerServices, IUserActionServices userActionServices, ApplicationDbContext context)
 {
     this.env                    = env;
     this.usersService           = usersService;
     this.currentUserService     = currentUserService;
     this.userServiceDetail      = userServiceDetail;
     this.companiesService       = companiesService;
     this.applyService           = applyService;
     this.authService            = authService;
     this.companyManagerServices = companyManagerServices;
     this.userActionServices     = userActionServices;
     this.context                = context;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="usersService"></param>
 /// <param name="currentUserService"></param>
 /// <param name="applyService"></param>
 /// <param name="applyInDayService"></param>
 /// <param name="applyServiceCreate"></param>
 /// <param name="vacationCheckServices"></param>
 /// <param name="context"></param>
 /// <param name="companiesService"></param>
 /// <param name="verifyService"></param>
 /// <param name="authService"></param>
 /// <param name="recallOrderServices"></param>
 /// <param name="userActionServices"></param>
 /// <param name="dataDictionariesServices"></param>
 public ApplyController(IUsersService usersService, ICurrentUserService currentUserService, IApplyVacationService applyService, IApplyInDayService applyInDayService, IApplyServiceCreate applyServiceCreate, IVacationCheckServices vacationCheckServices, ApplicationDbContext context, ICompaniesService companiesService, IVerifyService verifyService, IGoogleAuthService authService, IRecallOrderServices recallOrderServices, IUserActionServices userActionServices, IDataDictionariesServices dataDictionariesServices)
 {
     this.usersService             = usersService;
     this.currentUserService       = currentUserService;
     this.applyService             = applyService;
     this.applyInDayService        = applyInDayService;
     this.applyServiceCreate       = applyServiceCreate;
     this.context                  = context;
     this.companiesService         = companiesService;
     this.verifyService            = verifyService;
     this.authService              = authService;
     this.recallOrderServices      = recallOrderServices;
     this.userActionServices       = userActionServices;
     this.dataDictionariesServices = dataDictionariesServices;
 }
 public HomeController(
     IAppEmailService emailService,
     IGoogleAuthService gmailService,
     IGmailApiService apiService,
     IHttpContextAccessor httpContextAccessor,
     IViewModelMapper <Email, EmailViewModel> emailMapper,
     IViewModelMapper <IReadOnlyCollection <Email>, HomeViewModel> homeMapper)
 {
     this.emailService        = emailService ?? throw new ArgumentNullException(nameof(emailService));
     this.gmailService        = gmailService ?? throw new ArgumentNullException(nameof(gmailService));
     this.apiService          = apiService ?? throw new ArgumentNullException(nameof(apiService));
     this.httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     this.emailMapper         = emailMapper ?? throw new ArgumentNullException(nameof(emailMapper));
     this.homeMapper          = homeMapper ?? throw new ArgumentNullException(nameof(homeMapper));
 }
        public AuthorizationViewModel(IMainModel mainModel, IGoogleAuthService googleAuthService, IGoogleOAuth2Service googleOAuth2Service, INavigationService navigationService, IMessageBoxService messageBoxService, ISystemTrayService systemTrayService)
        {
            _mainModel = mainModel;
            _googleAuthService = googleAuthService;
            _googleOAuth2Service = googleOAuth2Service;
            _navigationService = navigationService;
            _messageBoxService = messageBoxService;
            _systemTrayService = systemTrayService;

            PageLoadedCommand = new RelayCommand(() =>
            {
                ShowBrowser = true;

                WebBrowserSourceUri = _googleAuthService.GetAuthUri();
            });

            WebBrowserNavigatingCommand = new RelayCommand<NavigatingEventArgs>(e =>
            {
                if (_showBrowser)
                {
                    _systemTrayService.SetProgressIndicator("");
                }

                if (e.Uri == null || e.Uri.Host != "localhost")
                    return;

                ShowBrowser = false;

                WebBrowserSourceUri = new Uri("https://accounts.google.com/Logout");

                var queryString = e.Uri.QueryString();

                ExchangeAuthorizationCode(queryString.GetValue("code"));
            });

            WebBrowserNavigatedCommand = new RelayCommand<NavigationEventArgs>(e =>
            {
                if (_showBrowser)
                {
                    _systemTrayService.HideProgressIndicator();
                }
            });

            WebBrowserNavigationFailedCommand = new RelayCommand<NavigationFailedEventArgs>(e =>
            {
                _systemTrayService.HideProgressIndicator();
            });
        }
Beispiel #17
0
        /// <summary>
        /// 获取授权人
        /// </summary>
        /// <param name="model"></param>
        /// <param name="authService"></param>
        /// <param name="currentUserId"></param>
        /// <returns></returns>
        public static string AuthUser(this GoogleAuthDataModel model, IGoogleAuthService authService, string currentUserId)
        {
            var result = currentUserId;

            if (model?.AuthByUserID != null)
            {
                if (!model.Verify(authService, result))
                {
                    throw new ActionStatusMessageException(ActionStatusMessage.Account.Auth.AuthCode.Invalid);
                }
                result = model.AuthByUserID;
            }
            if (result == null)
            {
                throw new ActionStatusMessageException(ActionStatusMessage.Account.Auth.Permission.AuthUserNotSet);
            }
            return(result);
        }
 public EmailController(
     EmailAppManagerContext context,
     IAppEmailService emailService,
     IGoogleAuthService googleService,
     IGmailApiService apiService,
     IListingServices listingServices,
     IViewModelMapper <Email, EmailViewModel> emailMapper,
     IViewModelMapper <IReadOnlyCollection <Email>, HomeViewModel> homeMapper,
     IViewModelMapper <IReadOnlyCollection <Email>, ListingAllEmailsViewModel> allEmailsListingMapper,
     IViewModelMapper <IReadOnlyCollection <Email>, ListingValidEmailsViewModel> validEmailsListingMapper)
 {
     this.context                  = context ?? throw new ArgumentNullException(nameof(context));
     this.emailService             = emailService ?? throw new ArgumentNullException(nameof(emailService));
     this.googleService            = googleService ?? throw new ArgumentNullException(nameof(googleService));
     this.apiService               = apiService ?? throw new ArgumentNullException(nameof(apiService));
     this.listingServices          = listingServices ?? throw new ArgumentNullException(nameof(listingServices));
     this.emailMapper              = emailMapper ?? throw new ArgumentNullException(nameof(emailMapper));
     this.allEmailsListingMapper   = allEmailsListingMapper ?? throw new ArgumentNullException(nameof(allEmailsListingMapper));
     this.validEmailsListingMapper = validEmailsListingMapper ?? throw new ArgumentNullException(nameof(validEmailsListingMapper));
 }
 public AuthenticationService(ApiDbContext _ctx,
                              UserManager <User> _userManager,
                              SignInManager <User> _signInManager,
                              IHttpContextAccessor _httpContextAccessor,
                              IGoogleAuthService _googleAuthService,
                              IFacebookAuthService _facebookAuthService,
                              IEmailService _emailService,
                              IOptions <AuthenticationOptions> _authenticationOptions,
                              IOptions <GoogleOptions> _googleOptions,
                              IMapper _mapper)
 {
     ctx                   = _ctx;
     userManager           = _userManager;
     signInManager         = _signInManager;
     facebookAuthService   = _facebookAuthService;
     mapper                = _mapper;
     authenticationOptions = _authenticationOptions;
     googleAuthService     = _googleAuthService;
     emailService          = _emailService;
     httpContextAccessor   = _httpContextAccessor;
 }
        /// <summary>
        /// 账号管理
        /// </summary>
        /// <param name="userManager"></param>
        /// <param name="signInManager"></param>
        /// <param name="emailSender"></param>
        /// <param name="logger"></param>
        /// <param name="usersService"></param>
        /// <param name="verifyService"></param>
        /// <param name="authService"></param>
        /// <param name="context"></param>
        /// <param name="currentUserService"></param>
        /// <param name="userActionServices"></param>
        /// <param name="cipperServices"></param>
        /// <param name="permissionServices"></param>

        public AccountController(
            UserManager <ApplicationUser> userManager,
            SignInManager <ApplicationUser> signInManager,
            IEmailSender emailSender,
            ILogger <AccountController> logger,
            IUsersService usersService, IVerifyService verifyService, IGoogleAuthService authService, ApplicationDbContext context, ICurrentUserService currentUserService, IUserActionServices userActionServices,
            ICipperServices cipperServices, IPermissionServices permissionServices)
        {
            _userManager            = userManager;
            _signInManager          = signInManager;
            _emailSender            = emailSender;
            _logger                 = logger;
            _usersService           = usersService;
            _verifyService          = verifyService;
            _authService            = authService;
            _context                = context;
            this.currentUserService = currentUserService;
            _userActionServices     = userActionServices;
            this.cipperServices     = cipperServices;
            this.permissionServices = permissionServices;
        }
 public GoogleDriveRestfulService2(IConfigurationRetriever configurationRetriever, IGoogleAuthService googleAuthService, IGoogleDriveService googleDriveService)
 {
     _configurationRetriever = configurationRetriever;
     _googleAuthService = googleAuthService;
     _googleDriveService = googleDriveService;
 }
Beispiel #22
0
        public MainPage()
        {
            InitializeComponent();

            _googleAuthService = DependencyService.Resolve <IGoogleAuthService>();
        }
Beispiel #23
0
        /// <summary>
        /// 获取授权人本人
        /// </summary>
        /// <param name="model"></param>
        /// <param name="authService"></param>
        /// <param name="usersService"></param>
        /// <param name="currentUserId"></param>
        /// <returns></returns>
        public static DAL.Entities.UserInfo.User AuthUser(this GoogleAuthDataModel model, IGoogleAuthService authService, IUsersService usersService, string currentUserId)
        {
            var u    = model.AuthUser(authService, currentUserId);
            var user = usersService.GetById(u);

            if (user == null)
            {
                throw new ActionStatusMessageException(ActionStatusMessage.Account.Auth.Permission.AuthUserNotExist);
            }
            return(user);
        }
Beispiel #24
0
 public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, IHttpClient httpClient, IJsonSerializer jsonSerializer, IApplicationHost appHost)
     : base(applicationPaths, xmlSerializer)
 {
     Instance          = this;
     GoogleAuthService = new GoogleAuthService(httpClient, jsonSerializer, appHost);
 }
Beispiel #25
0
 public YoutubeApiService(IGoogleAuthService googleAuthService)
 {
     _googleAuthService = googleAuthService;
 }
Beispiel #26
0
 public GoogleDriveRestfulService2(IConfigurationRetriever configurationRetriever, IGoogleAuthService googleAuthService, IGoogleDriveService googleDriveService)
 {
     _configurationRetriever = configurationRetriever;
     _googleAuthService      = googleAuthService;
     _googleDriveService     = googleDriveService;
 }
        public GoogleOAuth2Service(IGoogleAuthService googleAuthService)
        {
            _googleAuthService = googleAuthService;

            _client = googleAuthService.CreateRestClient("https://www.googleapis.com/oauth2/v2/");
        }
 public GmailController(IGmailApiService gmailService,
                        IGoogleAuthService gmailAuthService)
 {
     this.gmailService     = gmailService ?? throw new ArgumentNullException(nameof(gmailService));
     this.gmailAuthService = gmailAuthService ?? throw new ArgumentNullException(nameof(gmailAuthService));
 }
 public AuthService(IOptions <AuthSettings> options, ILogger <AuthService> logger, IGoogleAuthService googleAuthService)
 {
     settings               = options.Value;
     this.logger            = logger;
     this.googleAuthService = googleAuthService;
 }
Beispiel #30
0
 /// <summary>
 /// 检查当前填入的是否正确
 /// </summary>
 /// <param name="model"></param>
 /// <param name="authService"></param>
 /// <param name="currentUserId"></param>
 /// <returns></returns>
 public static bool Verify(this GoogleAuthDataModel model, IGoogleAuthService authService, string currentUserId) => model?.AuthByUserID == currentUserId || (model != null && authService.Verify(Convert.ToInt32(model?.Code ?? "0"), model?.AuthByUserID));