/// <summary>
        /// Default constructor that Lambda will invoke.
        /// </summary>
        public Functions()
        {
            // configure data access
            var region = RegionEndpoint.GetBySystemName(
                GetEnvironmentVariableWithDefault("AWS_DEFAULT_REGION", "us-east-1"));

            var ddb = new AmazonDynamoDBClient(region);
            var ctx = new DynamoDBContext(ddb, new DynamoDBContextConfig
            {
                ConsistentRead = true
            });

            _DataAccess = new AwsDataAccess(ctx);

            // configure auth0
            var assembly = typeof(Functions).GetTypeInfo().Assembly;
            var auth0    = JsonConvert.DeserializeObject <Auth0Options>(
                ResourceHelper.GetResourceAsString(
                    assembly,
                    "NoServers.Aws.auth0.json"));
            var tokenVerifierOptions = new TokenVerifierOptions($"https://{auth0.Domain}/", auth0.ClientId,
                                                                CertificateHelper.GetCertificateFromResource(
                                                                    assembly,
                                                                    "NoServers.Aws.private.key"
                                                                    ));

            _TokenVerifier = new TokenVerifier(tokenVerifierOptions);

            // use camelCasing when returning JSON
            JsonConvert.DefaultSettings =
                () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
        }
Beispiel #2
0
 public LogoutController(ILogger <LogoutController> logger, NotificationsEnabledDb database,
                         ITokenVerifier csrfVerifier)
 {
     this.logger       = logger;
     this.database     = database;
     this.csrfVerifier = csrfVerifier;
 }
 public NotificationsHub(ILogger <NotificationsHub> logger, ITokenVerifier csrfVerifier,
                         ApplicationDbContext database)
 {
     this.logger       = logger;
     this.csrfVerifier = csrfVerifier;
     this.database     = database;
 }
Beispiel #4
0
 public AuthService(IProducer producer, IAuthContext authContext, ITokenVerifier tokenVerifier, IMapper mapper,
                    ILogger <AuthService> logger)
 {
     _producer      = producer;
     _authContext   = authContext;
     _tokenVerifier = tokenVerifier;
     _mapper        = mapper;
     _logger        = logger;
 }
 public RegistrationController(ILogger <RegistrationController> logger, IRegistrationStatus configuration,
                               ITokenVerifier csrfVerifier, NotificationsEnabledDb database, IBackgroundJobClient jobClient)
 {
     this.logger        = logger;
     this.configuration = configuration;
     this.csrfVerifier  = csrfVerifier;
     this.database      = database;
     this.jobClient     = jobClient;
 }
        public TokenController(
            IPrivateKeyStore privateKeyStore,
            IPublicKeyStore publicKeyStore,
            ITokenGenerator tokenGenerator,
            ITokenVerifier tokenVerifier)
        {
            _privateKeyStore = privateKeyStore;
            _publicKeyStore  = publicKeyStore;
            _tokenGenerator  = tokenGenerator;
            _tokenVerifier   = tokenVerifier;

            _ecParameters = CustomNamedCurves.GetByOid(X9ObjectIdentifiers.Prime256v1);
        }
        /// <summary>
        /// Creates the instance with default providers and configuration
        /// </summary>
        public TokenAuthorisationService()
        {
            // create default
            tokenProvider = new EncryptionTokenProvider(
                new StringCryptoTransformer(
                    new NameValueSectionConfigurationProvider(ConfigSectionsResource.DefaultStringEncryptorSectionName)),
                    new NameValueSectionConfigurationProvider(ConfigSectionsResource.DefaultEncryptionTokenProviderSectionName));
            tokenVerifier = new EncryptionTokenVerifier(
                new StringCryptoTransformer(
                    new NameValueSectionConfigurationProvider(ConfigSectionsResource.DefaultStringEncryptorSectionName)),
                    new TokenDateTimeVerifier());

        }
        public LoginController(ILogger <LoginController> logger, NotificationsEnabledDb database,
                               IConfiguration configuration, ITokenVerifier csrfVerifier,
                               RedirectVerifier redirectVerifier, IPatreonAPI patreonAPI, IBackgroundJobClient jobClient) : base(logger,
                                                                                                                                 database)
        {
            this.configuration    = configuration;
            this.csrfVerifier     = csrfVerifier;
            this.redirectVerifier = redirectVerifier;
            this.patreonAPI       = patreonAPI;
            this.jobClient        = jobClient;

            useSecureCookies = Convert.ToBoolean(configuration["Login:SecureCookies"]);

            localLoginEnabled = Convert.ToBoolean(configuration["Login:Local:Enabled"]);
        }
 public TokenAuthorisationService(ITokenProvider tokenProvider, ITokenVerifier tokenVerifier) : this()
 {
     this.tokenProvider = tokenProvider;
     this.tokenVerifier = tokenVerifier;
 }
Beispiel #10
0
 public CSRFCheckerMiddleware(ITokenVerifier csrfVerifier)
 {
     this.csrfVerifier = csrfVerifier;
 }
 public AnonymousTokenValidationService(IAnonymousTokenKeySource anonymousTokenKeySource, ISeedStore seedStore)
 {
     _anonymousTokenKeySource = anonymousTokenKeySource;
     _tokenVerifier           = new TokenVerifier(seedStore);
 }