public PaymentGatewayController(IAuthorizeService authorizeService, ICaptureService captureService, IVoidService voidService, IRefundService refundService) { _authorizeService = authorizeService; _captureService = captureService; _voidService = voidService; _refundService = refundService; }
private void AttachUserToContext(HttpContext context, IAuthorizeService autheticateService, IUserService userService, string token) { try { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(_appSettings.Key); tokenHandler.ValidateToken(token, new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false, // set clockskew to zero so tokens expire exactly at token expiration time (instead of 5 minutes later) ClockSkew = TimeSpan.Zero }, out SecurityToken validatedToken); var jwtToken = (JwtSecurityToken)validatedToken; var userId = int.Parse(jwtToken.Claims.First(x => x.Type == "id").Value); // attach user to context on successful jwt validation // To DO: Get user from service context.Items["User"] = userService.GetById(userId); } catch (Exception e) { // do nothing if jwt validation fails // user is not attached to context so request won't have access to secure routes } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="appSetgings"><see cref="IAppSettings"/></param> /// <param name="authorizeService"><see cref="IAuthorizeService"/></param> public TokenController( IAppSettings appSetgings, IAuthorizeService authorizeService) { _appSetgings = appSetgings; _authorizeService = authorizeService; }
/// <summary> /// /// </summary> /// <param name="questionRepo"></param> public QuestionsController( IQuestionRepository questionRepo, IAuthorizeService authorizeService) : base(authorizeService) { _questionRepo = questionRepo; _authorizeService = authorizeService; }
public LoginController(ITokenBuilder tokenBuilder, ILogger <LoginController> logger, IAuthorizeService authorizeService, IOptionsMonitor <AudienceViewModel> audienceModel) { _logger = logger; _tokenBuilder = tokenBuilder; _authorizeService = authorizeService; _audienceModel = audienceModel.CurrentValue; }
public AuthorizeController(IMasterRepository masterRepo, IAuthorizeService authorizeService, IUserRepository userRepository) { _hostingEnvironment = UtilsProvider.HostingEnvironment; _masterRepo = masterRepo; _authorizeService = authorizeService; _UserRepository = userRepository; }
public MenuController( IMenuRepository menuRepo, IAuthorizeService authorizeService) : base(authorizeService) { _menuRepo = menuRepo; _authorizeService = authorizeService; }
public void OnAuthorization(AuthorizationFilterContext context) { IAuthorizeService authorizeService = (IAuthorizeService)context.HttpContext.RequestServices.GetService(typeof(IAuthorizeService)); bool result = authorizeService.AuthorizeNormal(context); if (!result) { switch (_authorizeAttributeType) { case AuthorizeAttributeTypes.Mvc: { context.Result = new RedirectToActionResult("Login", "Auth", null); return; } case AuthorizeAttributeTypes.Api: { context.Result = new UnauthorizedResult(); return; } default: { throw new Exception($"Unsupported AuthorizeAttributeType"); } } } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="accountService"><see cref="IAccountService"/></param> /// <param name="authorizeService"><see cref="IAuthorizeService"/></param> public AccountController( IAccountService accountService, IAuthorizeService authorizeService) { _accountService = accountService; _authorizetService = authorizeService; }
public PerformanceEvaluationsController(IPerformanceEvalutionService performanceEvaluationService, IAuthorizeService authorizeService, INotificationService notificationService) { _performanceEvaluationService = performanceEvaluationService; _authorizeService = authorizeService; _notificationService = notificationService; _context = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); }
public RaterService(IAuthorizeService auth, IAtomEntryRepository repo, ILogService logger, IRouteService router) { AuthorizeService = auth; AtomEntryRepository = repo; LogService = logger; RouteService = router; }
public RatingController( IRatingRepository ratingRepo, UserManager <ApplicationUser> userManager, IAuthorizeService authorizeService) : base(authorizeService) { _ratingRepo = ratingRepo; _userManager = userManager; }
public ParticipantController( IParticipantRepository participantRepository, UserManager <Domain.User.ApplicationUser> userManager, IAuthorizeService authorizationService) : base(authorizationService) { _participantRepository = participantRepository; _userManager = userManager; }
public StylingController( IStyleRepository styleRepo, IMenuRepository menuRepo, IAuthorizeService authorizeService) : base(authorizeService) { _styleRepo = styleRepo; _authorizeService = authorizeService; }
public DictatenController( IDictaatRepository dictaatRepo, UserManager <Domain.User.ApplicationUser> userManager, IAuthorizeService authorizationService) : base(authorizationService) { _authorizationService = authorizationService; _dictaatRepo = dictaatRepo; _userManager = userManager; }
/// <summary> /// default constructor /// </summary> /// <param name="pollRepository"></param> /// <param name="userManager"></param> /// <param name="authorizeService"></param> public PollController( IPollRepository pollRepository, UserManager <ApplicationUser> userManager, IAuthorizeService authorizeService) : base(authorizeService) { _pollRepository = pollRepository; _authorizeService = authorizeService; _userManager = userManager; }
/// <summary> /// Default constructor /// </summary> /// <param name="quizRepo"></param> /// <param name="userManager"></param> /// <param name="authorizeService"></param> public QuizController( IQuizRepository quizRepo, UserManager <ApplicationUser> userManager, IAuthorizeService authorizeService) : base(authorizeService) { _userManager = userManager; _quizRepo = quizRepo; _authorizeService = authorizeService; }
public UserController(IUserService userService, IAuthorizeService authorizeService, IRoleService roleService, IMapper mapper, IEncryptionService encryptionService, IWorkContext workContext) { this.userService = userService; this.authorizeService = authorizeService; this.roleService = roleService; this.mapper = mapper; this.encryptionService = encryptionService; this.workContext = workContext; }
public OrganizationsController(IOrganizationTypesService organizationTypesService, IOrganizationsService organizationsService, IAuthorizeService authService, ICalendarService calendarService) { _organizationTypesService = organizationTypesService; _organizationsService = organizationsService ?? throw new ArgumentNullException(nameof(organizationsService)); _authService = authService; _organizationsService.ValidationDictionary = new ValidationDictionary(ModelState); _calendarService = calendarService ?? throw new ArgumentNullException(nameof(calendarService)); }
public OAuthController( IAuthorizeService authorizeService, IValidateTokenService validateTokenService, IGenerateTokenService generateTokenService) { _authorizeService = authorizeService; _validateTokenService = validateTokenService; _generateTokenService = generateTokenService; }
public AssignmentController( IAuthorizeService authorizeService, IAssignmentRepository assignmentRepo, UserManager <Domain.User.ApplicationUser> userManager) : base(authorizeService) { _assignmentRepo = assignmentRepo; _userManager = userManager; _authorizeService = authorizeService; }
public PagesController( IPageRepository pageRepo, IMenuRepository menuRepo, IAuthorizeService authorizeService) : base(authorizeService) { _pageRepo = pageRepo; _menuRepo = menuRepo; _authorizeService = authorizeService; }
public ImageService(ReportContext reportContext, IAuthorizeService authorizeService) { _authorizeService = authorizeService; _context = reportContext; String storageConnectionString = "DefaultEndpointsProtocol=https;AccountName=reportpictures;AccountKey=3cxwdbIYl0MBEy0Aaa0TCuUmBZ3KHmBjT2bogu/IUTsU2VPhxPo38Vi/AKXy+tQB//VKTm0VQZ7ewUqJHZGDbQ==;EndpointSuffix=core.windows.net"; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString); client = storageAccount.CreateCloudBlobClient(); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="options"><see cref="AuthenticationSchemeOptions"/></param> /// <param name="logger"><see cref="ILoggerFactory"/></param> /// <param name="encoder"><see cref="UrlEncoder"/></param> /// <param name="clock"><see cref="ISystemClock"/></param> /// <param name="authorizeService"><see cref="IAuthorizeService"/></param> public BearerAuthenticationHandler( IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IAuthorizeService authorizeService) : base(options, logger, encoder, clock) { _logger = logger.CreateLogger <BearerAuthenticationHandler>(); _authorizeService = authorizeService; }
public async Task Invoke(HttpContext context, IAuthorizeService autheticateService, IUserService userService) { var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last(); if (token != null) { AttachUserToContext(context, autheticateService, userService, token); } await _next(context); }
public BlogMLService(IAppServiceRepository svcRepo, IAtomPubService atompub, IAnnotateService annotate, IUserRepository usersRepo, IAuthorizeService auth, ILogService logger) { AppServiceRepository = svcRepo; AtomPubService = atompub; AnnotateService = annotate; UserRepository = usersRepo; AuthorizeService = auth; LogService = logger; progress = new Progress(); }
public AccountService(IManageProjectRepository manageProjectRepository, ISystemsRepository systemsRepository, AspNetUsersRepository aspNetUsersRepository, AspNetUserRolesRepository aspNetUserRolesRepository, AspNetUserTokensRepository aspNetUserTokensRepo, /*ResoUserIntManager userManager*/ LogService logService, AspNetUsersService aspNetUsersService, AccountRepository repo, AccountServiceModel model, IAuthorizeService IAuthorizeService) : base(repo, model) { _aspNetUserRolesRepository = aspNetUserRolesRepository; _systemsRepository = systemsRepository; _manageProjectRepository = manageProjectRepository; _aspNetUsersRepository = aspNetUsersRepository; _aspNetUserTokensRepo = aspNetUserTokensRepo; //_userManager = userManager; log = logService; _aspNetUsersService = aspNetUsersService; _IAuthorizeService = IAuthorizeService; }
public AdminService(IAtomPubService atompub, IAnnotateService anno, IAuthorizeService auth, ILogService logger, IRouteService route, IThemeService themeSvc, IAppServiceRepository svcRepo) { AtomPubService = atompub; AnnotateService = anno; AuthorizeService = auth; RouteService = route; LogService = logger; ThemeService = themeSvc; AppServiceRepository = svcRepo; atompub.SettingEntryLinks += (e) => SetLinks(e); }
public MasterController(IAuthorizeService authorizeService, IUnitOfWork unitOfWork, IMasterRepository masterRepository) { _hostingEnvironment = UtilsProvider.HostingEnvironment; _config = UtilsProvider.Config; _appSetting = UtilsProvider.AppSetting; _unitOfWork = unitOfWork; // ------------- แบบนี้จะอ้าง ถึง Repo ตรงๆ ไม่รอรับการทำ AutoMate-Test ได้ //_masterRepository = new MasterRepository(_hostingEnvironment, _config); // ------------- ควรใช้แบบนี้ _masterRepository = masterRepository; _authorizeService = authorizeService; }
public ShellViewModel(INavigationService navigationService, IAuthorizeService authorizeService) { this.navigationService = navigationService; this.authorizeService = authorizeService; authorizeService.AuthenticatedChanged += AuthorizeService_AuthenticatedChanged; //ShowVehiclesCommand = new RelayCommand(() => ShowVehicles()); //ShowEmployeesCommand = new RelayCommand(() => ShowEmployees()); ShowViewCommand = new RelayCommand <string>(p => ShowView(p)); }
public Grant(IHttpContextAccessor httpContextAccessor, IAuthenticationCookieService authCookieService, IAuthenticationSessionService authSessionService, IAuthorizeService authorizeService, AuthorizeLevel grantType = AuthorizeLevel.NeedAuthorize, GrantPriority grantPriority = GrantPriority.Default) { _httpContextAccessor = httpContextAccessor; _authCookieService = authCookieService; _authSessionService = authSessionService; _authorizeService = authorizeService; _grantType = grantType; _httpContext = _httpContextAccessor.HttpContext; _isAuthenticationChecked = "IsAuthenticationChecked"; _grantPriority = grantPriority; }
public LoginViewModel(IProfileRepository profileRepository, INavigationService navigationService, IAuthorizeService authorizeService ) { this.profileRepository = profileRepository; this.navigationService = navigationService; this.authorizeService = authorizeService; Profiles = profileRepository.Get(); CancelCommand = new RelayCommand(() => Cancel()); LoginCommand = new RelayCommand(() => Login()); }
public AnnotateService(IContainer container, IAtomPubService atompub, IAppServiceRepository svcRepo, IAuthorizeService auth, IAtomEntryRepository entryRepo, IMediaRepository mediaRepo, ILogService logger) { AppService = svcRepo.GetService(); AtomPubService = atompub; AuthorizeService = auth; AtomEntryRepository = entryRepo; MediaRepository = mediaRepo; Container = container; LogService = logger; atompub.SettingEntryLinks += (e) => SetLinks(e); atompub.SettingFeedLinks += (f) => SetLinks(f); }
public ExportController(ReportContext context, IAuthorizeService authorizeService, IImageService imageService, IEmailService emailService) { _context = context; _imageService = imageService; _authorizeService = authorizeService; _emailService = emailService; _imageHandler = new ImageHandler(); _largeRegularFont = new XFont("Arial", 20, XFontStyle.Bold); _medRegularFont = new XFont("Arial", 13, XFontStyle.Regular); _medBoldFont = new XFont("Arial", 13, XFontStyle.Bold); _smallRegularFont = new XFont("Arial", 8, XFontStyle.Regular); _smallBoldFont = new XFont("Arial", 8, XFontStyle.Bold); _document = new PdfDocument(); _color = new XSolidBrush(XColor.FromArgb(179, 204, 204)); _text = new ReportText(); }
public AtomPubService( IAppServiceRepository appServiceRepository, IAppCategoriesRepository appCategoriesRepository, IAtomEntryRepository atomEntryRepository, IMediaRepository mediaRepository, IAuthorizeService authorizeService, IContainer container, ILogService logger) { this.AppServiceRepository = appServiceRepository; this.AppCategoriesRepository = appCategoriesRepository; this.AtomEntryRepository = atomEntryRepository; this.MediaRepository = mediaRepository; this.AuthorizeService = authorizeService; this.Container = container; this.LogService = logger; }
public BlogService(IAtomPubService atompub, IAnnotateService annotate, IAppServiceRepository svcRepo, IContainer container, IAtomEntryRepository entryRepo, IAuthorizeService auth, ILogService logger, ICleanContentService cleaner) { this.AppService = svcRepo.GetService(); this.AppServiceRepository = svcRepo; this.AtomEntryRepository = entryRepo; this.Container = container; this.AnnotateService = annotate; this.AuthorizeService = auth; this.LogService = logger; this.CleanContentService = cleaner; atompub.CreatingEntry += OnModifyEntry; atompub.UpdatingEntry += OnModifyEntry; annotate.AnnotatingEntry += OnAnnotateEntry; atompub.SettingEntryLinks += (e) => SetLinks(e); atompub.SettingFeedLinks += (f) => SetLinks(f); }
//public static void Auth(this IAuthorizeService auth, AuthAction action) //{ // Auth(auth, null, action); //} public static void SetPerson(this AtomEntry entry, IAuthorizeService auth, bool forceAuthor) { //TODO: how to handle existing people, validate them? //determine if current user is an author or contributor User u = System.Threading.Thread.CurrentPrincipal.Identity as User; if (!u.IsAuthenticated) return; List<AtomPerson> authors = entry.Authors.ToList(); if (auth.GetRoles(u, entry.Id.ToScope()) >= AuthRoles.Author || forceAuthor) { AtomPerson author = u.ToAtomAuthor(); if (!authors.Contains(author)) { authors.Add(author); //add entry.Authors = authors; //update } } else if (auth.GetRoles(u, entry.Id.ToScope()) >= AuthRoles.Contributor) { List<AtomPerson> contribs = entry.Contributors.ToList(); AtomPerson contrib = u.ToAtomContributor(); if (!contribs.Contains(contrib)) { contribs.Add(contrib); //add entry.Contributors = contribs; //update } } else //default to author { AtomPerson author = u.ToAtomAuthor(); if (!authors.Contains(author)) { authors.Add(author); //add entry.Authors = authors; //update } } }
public static void SetPerson(this AtomEntry entry, IAuthorizeService auth) { SetPerson(entry, auth, false); }
/// <summary> /// Basic constructor with needed service /// </summary> /// <param name="authorizeService">The membershipService used for authenticating a member</param> /// <remarks> /// Should be created with UnityContainer and Constructor parameter injection /// </remarks> public AuthorizeController(IAuthorizeService authorizeService) { this.authorizeService = authorizeService; }