Example #1
0
 public ServeService(IContactService contactService,
                     IContactRelationshipService contactRelationshipService,
                     IOpportunityService opportunityService,
                     MinistryPlatform.Translation.Services.Interfaces.IEventService eventService,
                     IParticipantService participantService,
                     IGroupParticipantService groupParticipantService,
                     IGroupService groupService,
                     ICommunicationService communicationService,
                     IAuthenticationService authenticationService,
                     IConfigurationWrapper configurationWrapper,
                     IApiUserService apiUserService,
                     IResponseService responseService)
 {
     _contactService = contactService;
     _contactRelationshipService = contactRelationshipService;
     _opportunityService = opportunityService;
     _eventService = eventService;
     _participantService = participantService;
     _groupParticipantService = groupParticipantService;
     _groupService = groupService;
     _communicationService = communicationService;
     _authenticationService = authenticationService;
     _configurationWrapper = configurationWrapper;
     _apiUserService = apiUserService;
     _responseService = responseService;
 }
Example #2
0
        private void attachUserToContext(HttpContext context, IApiUserService userService, string token)
        {
            try
            {
                var tokenHandler = new JwtSecurityTokenHandler();
                var key          = Encoding.ASCII.GetBytes(_appSettings.Secret);
                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
                context.Items["User"] = userService.GetById(userId);
            }
            catch
            {
                // do nothing if jwt validation fails
                // user is not attached to context so request won't have access to secure routes
            }
        }
 public ContactAttributeService(IAuthenticationService authenticationService, 
     IConfigurationWrapper configurationWrapper, 
     IMinistryPlatformService ministryPlatformService, 
     IApiUserService apiUserService)
     : base(authenticationService, configurationWrapper)
 {
     _ministryPlatformService = ministryPlatformService;
     _apiUserService = apiUserService;
 }
 public LoginUserFeatureSteps()
 {
     _requestDto = new HttpResponseModel();
     _response   = new HttpResponseModel();
     _htpClient  = HttpClientService.HttpClient;
     //_apiClient = new ApiClient(httpClientFactory);
     _apiClient              = new ApiClient();
     _apiUserService         = new ApiUserService(_apiClient);
     _ExpectedHttpStatusCode = 200;
 }
Example #5
0
        public async Task Invoke(HttpContext context, IApiUserService userService)
        {
            var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();

            if (token != null)
            {
                attachUserToContext(context, userService, token);
            }

            await _next(context);
        }
 public OpportunityServiceImpl(IMinistryPlatformService ministryPlatformService,
                               IAuthenticationService authenticationService,
                               IConfigurationWrapper configurationWrapper,
                               IParticipantService participantService,
     IApiUserService apiUserService)
     : base(authenticationService, configurationWrapper)
 {
     _ministryPlatformService = ministryPlatformService;
     _participantService = participantService;
     _apiUserService = apiUserService;
 }
        public GroupParticipantService(IDbConnection dbConnection,
                                       IConfigurationWrapper configurationWrapper,
                                       IMinistryPlatformService ministryPlatformService,
                                       IApiUserService apiUserService)

        {
            _dbConnection = dbConnection;
            _configurationWrapper = configurationWrapper;
            _ministryPlatformService = ministryPlatformService;
            _apiUserService = apiUserService;
        }
Example #8
0
 public AccountController(UserManager <AppUser> userManager,
                          IIdentityServerInteractionService interaction,
                          IAuthenticationSchemeProvider schemeProvider,
                          IClientStore clientStore,
                          IEventService events,
                          SignInManager <AppUser> signInManager,
                          IApiUserService apiUserService)
 {
     _userManager    = userManager;
     _interaction    = interaction;
     _schemeProvider = schemeProvider;
     _clientStore    = clientStore;
     _events         = events;
     _signInManager  = signInManager;
     _apiUserService = apiUserService;
 }
Example #9
0
 public EventService(TranslationEventService eventService,
                     IGroupService groupService,
                     ICommunicationService communicationService,
                     IContactService contactService,
                     IContentBlockService contentBlockService,
                     IConfigurationWrapper configurationWrapper,
                     IApiUserService apiUserService,
                     IContactRelationshipService contactRelationshipService,
                     IGroupParticipantService groupParticipantService, IParticipantService participantService)
 {
     _eventService = eventService;
     _groupService = groupService;
     _communicationService = communicationService;
     _contactService = contactService;
     _contentBlockService = contentBlockService;
     _configurationWrapper = configurationWrapper;
     _apiUserService = apiUserService;
     _contactRelationshipService = contactRelationshipService;
     _groupParticipantService = groupParticipantService;
     _participantService = participantService;
 }
 public ChildcareService(IEventParticipantService eventParticipantService,
                         ICommunicationService communicationService,
                         IConfigurationWrapper configurationWrapper,
                         IContactService contactService,
                         MinistryPlatform.Translation.Services.Interfaces.IEventService eventService,
                         IParticipantService participantService,
                         IServeService serveService,
                         IDateTime dateTimeWrapper,
                         IApiUserService apiUserService, Interfaces.IEventService crdsEventService)
 {
     _eventParticipantService = eventParticipantService;
     _communicationService = communicationService;
     _configurationWrapper = configurationWrapper;
     _contactService = contactService;
     _crdsEventService = crdsEventService;
     _eventService = eventService;
     _participantService = participantService;
     _serveService = serveService;
     _dateTimeWrapper = dateTimeWrapper;
     _apiUserService = apiUserService;
 }
 public UsersController(IApiUserService userService)
 {
     _userService = userService;
 }
 public SimpleAuthorizationServerProvider(IApiUserService userService)
 {
     _userService = userService;
 }
Example #13
0
 public UserController()
 {
     userLogic = new ApiUserService();
 }
 public ApiAuthenticationHandler(IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IApiUserService userService)
     : base(options, logger, encoder, clock)
 {
     service = userService;
 }
Example #15
0
 public ApiUsersController(IApiUserService ApiUserservice)
 {
     _ApiUserservice = ApiUserservice;
 }
Example #16
0
 public ApiUsersController(IApiUserService apiUserService)
 {
     _apiUserService = apiUserService;
 }
Example #17
0
 public GetApiKey(DiscordOAuth options, IApiUserService apiUserService, DiscordApiClient apiClient)
 {
     _discordOAuth   = options;
     _apiUserService = apiUserService;
     _apiClient      = apiClient;
 }
Example #18
0
 public GameController(IApiUserService userService, IGameService gameService)
 {
     _userService = userService;
     _gameService = gameService;
 }
Example #19
0
 public ApiUsersController(IApiUserService apiUserService)
 {
     _apiUserService = apiUserService;
 }
 public TokenController(IApiUserService apiUserService, ITokenService tokenService, ILogger logger)
 {
     _apiUserService = apiUserService;
     _tokenService = tokenService;
     _logger = logger;
 }
Example #21
0
 public EventController(IMinistryPlatformService ministryPlatformService, IApiUserService apiUserService, IEventService eventService)
 {
     this._ministryPlatformService = ministryPlatformService;
     _eventService = eventService;
     _apiUserService = apiUserService;
 }
Example #22
0
 public UserController()
 {
     userLogic = (IApiUserService)Activator.GetObject(
         typeof(IApiUserService), ApiConfig.ApiUserServiceIp);
 }
Example #23
0
 public SimpleAuthorizationServerProvider(IApiUserService userService)
 {
     _userService = userService;
 }
Example #24
0
 public WuraController(IApiUserService apiUserService, IApiLocationService apiLocationService)
 {
     _apiUserService     = apiUserService;
     _apiLocationService = apiLocationService;
 }
Example #25
0
 public ApiKeyHandler(IApiUserService userService)
 {
     _userService = userService;
 }