コード例 #1
0
        /// <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()
            };
        }
コード例 #2
0
 public LogoutController(ILogger <LogoutController> logger, NotificationsEnabledDb database,
                         ITokenVerifier csrfVerifier)
 {
     this.logger       = logger;
     this.database     = database;
     this.csrfVerifier = csrfVerifier;
 }
コード例 #3
0
 public NotificationsHub(ILogger <NotificationsHub> logger, ITokenVerifier csrfVerifier,
                         ApplicationDbContext database)
 {
     this.logger       = logger;
     this.csrfVerifier = csrfVerifier;
     this.database     = database;
 }
コード例 #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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
        public TokenController(
            IPrivateKeyStore privateKeyStore,
            IPublicKeyStore publicKeyStore,
            ITokenGenerator tokenGenerator,
            ITokenVerifier tokenVerifier)
        {
            _privateKeyStore = privateKeyStore;
            _publicKeyStore  = publicKeyStore;
            _tokenGenerator  = tokenGenerator;
            _tokenVerifier   = tokenVerifier;

            _ecParameters = CustomNamedCurves.GetByOid(X9ObjectIdentifiers.Prime256v1);
        }
コード例 #7
0
        /// <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());

        }
コード例 #8
0
        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"]);
        }
コード例 #9
0
 public TokenAuthorisationService(ITokenProvider tokenProvider, ITokenVerifier tokenVerifier) : this()
 {
     this.tokenProvider = tokenProvider;
     this.tokenVerifier = tokenVerifier;
 }
コード例 #10
0
 public CSRFCheckerMiddleware(ITokenVerifier csrfVerifier)
 {
     this.csrfVerifier = csrfVerifier;
 }
 public AnonymousTokenValidationService(IAnonymousTokenKeySource anonymousTokenKeySource, ISeedStore seedStore)
 {
     _anonymousTokenKeySource = anonymousTokenKeySource;
     _tokenVerifier           = new TokenVerifier(seedStore);
 }