public void AddApiInfo(string api, string vcode)
 {
     ApiKeys.Add(new ApiInfo()
     {
         User = this, ApiKey = Convert.ToInt32(api), VerificationCode = vcode
     });
 }
Exemple #2
0
 /// <summary>
 /// This will add a key to the system but WILL not update the config file. You must call the Save method manually.
 /// </summary>
 /// <param name="key">The key to add. If it is already present, this method will return.</param>
 public void AddKey(string key)
 {
     lock (ApiKeys)
     {
         if (!ApiKeys.Contains(key))
         {
             ApiKeys.Add(key);
         }
     }
 }
Exemple #3
0
        public async Task <ExtendedApiKey> CreateNewApiKeyAsync(ExtendedUser user)
        {
            var newKey = new ExtendedApiKey {
                PublicKey  = "somePublic",
                PrivateKey = "somePrivate"
            };

            user.ApiKeys.Add(newKey);
            ApiKeys.Add(newKey);
            return(newKey);
        }
Exemple #4
0
        public HmacAuthenticationHandler(IOptionsMonitor <HmacAuthenticationOptions> optionsMonitor, ILoggerFactory logger, UrlEncoder urlEncoder, ISystemClock systemClock)
            : base(optionsMonitor, logger, urlEncoder, systemClock)
        {
            var localHostOnly = "127.0.0.1/32,::1/128";
            var wideOpen      = "0.0.0.0/0,::/0";

            ApiKeys.Add("088546f2aba049d093234b07bf926ab1", new ApiKey()
            {
                AccessKey          = "088546f2aba049d093234b07bf926ab1",
                EncryptedSecretKey = Encryption.Encrypt("pWN4NAwKk+SUokEvDNZ4fcX3t2ozTFPgypXKchk1ulM=", EncryptionKey.Value),
                CIDRs = localHostOnly
            });
        }
        void LoadApiKeys()
        {
            Log.Info("Load() apikeys");
            DbCommand command = GetCommand();

            command.CommandText = "SELECT * FROM ApiKey;";
            var reader = command.ExecuteReader();

            while (reader.Read())
            {
                ApiKeys.Add(CreateApiKey(reader));
            }
        }
Exemple #6
0
        private static void addApiParameters()
        {
            // OpenWeatherMap
            ApiKeys.Add(ApiEnum.OPENWEATHERMAP, "4ce3d25d1b8cb5953ba718abd11bd07a");
            ApiUrls.Add(ApiEnum.OPENWEATHERMAP, "http://api.openweathermap.org/data/2.5");

            // NewsAPI
            ApiKeys.Add(ApiEnum.NEWSAPI, "9d6d50c70043491ba1aa1a2048b4197a");

            // Google Maps Geocoding
            ApiKeys.Add(ApiEnum.GOOGLEMAPSGEOCODING, "AIzaSyCUWewgFV1-ALfuAQpGC3S5uHlud1ucj20");
            ApiUrls.Add(ApiEnum.GOOGLEMAPSGEOCODING, "https://maps.googleapis.com/maps/api/geocode/json?address=");
        }
Exemple #7
0
 public void AddApiKey(ApiKeySql apiKey)
 {
     ApiKeys.Add(apiKey);
 }