コード例 #1
0
        public async Task Authentication(Uri instanceUri, string consumerKey, string consumerSecret)
        {
            string url = instanceUri.ToString();

            if (string.IsNullOrEmpty(consumerKey))
            {
                var clientKey = await ClientKeyManager.GetMastodonKey(instanceUri.Host);

                var cachecClientKey = App.Setting.ClientKeys
                                      .Where(key => key.Service == ServiceType.Mastodon)
                                      .FirstOrDefault(key => string.Equals(key.Host, instanceUri.ToString(), StringComparison.OrdinalIgnoreCase));

                if (cachecClientKey == null)
                {
                    App.Setting.ClientKeys.Add(new ClientKeyCache(instanceUri, clientKey));

                    consumerKey    = clientKey.ClientId;
                    consumerSecret = clientKey.ClientSecret;
                }
                else
                {
                    consumerKey    = cachecClientKey.ClientId;
                    consumerSecret = cachecClientKey.ClientSecret;
                }
            }

            this._api = new MastodonApi(instanceUri, consumerKey, consumerSecret);

            this.AuthorizeUrl = this._api.OAuth.GetAuthorizeUrl(ApiScopes);

            App.Open(this.AuthorizeUrl);
        }
コード例 #2
0
 public InsertDataController(UserManager <ApplicationUser> user, IGenericBL <Devices> device, IGenericBL <Logs> log, ClientKeyManager clientKey)
 {
     _user      = user;
     _log       = log;
     _device    = device;
     _clientKey = clientKey;
 }
コード例 #3
0
 public HomeController(ILogger <HomeController> logger, EditBuilder builder, GSgenerator gSgenerator, ClientKeyManager clientKey,
                       UserManager <ApplicationUser> user)
 {
     _logger      = logger;
     _builder     = builder;
     _gSgenerator = gSgenerator;
     _clientKey   = clientKey;
     _user        = user;
 }