public string RegenenerateApiKey(string accountNameKey, string apiKey, string requesterId, RequesterType requesterType, string sharedClientKey) { // Ensure the clients are certified. if (sharedClientKey != Sahara.Core.Platform.Requests.RequestManager.SharedClientKey) { return(null); } //Get ACCOUNT var account = AccountManager.GetAccount(accountNameKey, true, AccountManager.AccountIdentificationType.AccountName); #region Validate Request var requesterName = string.Empty; var requesterEmail = string.Empty; var requestResponseType = RequestManager.ValidateRequest(requesterId, requesterType, out requesterName, out requesterEmail, Sahara.Core.Settings.Platform.Users.Authorization.Roles.Manager, Sahara.Core.Settings.Accounts.Users.Authorization.Roles.Manager); if (!requestResponseType.isApproved) { //Request is not approved, send results: //return new DataAccessResponseType { isSuccess = false, ErrorMessage = requestResponseType.requestMessage }; return(null); } #endregion var newKey = ApiKeysManager.RegenerateApiKey(account, apiKey); #region Log Account Activity if (!string.IsNullOrEmpty(newKey)) { try { //Object Log --------------------------- AccountLogManager.LogActivity( account.AccountID.ToString(), account.StoragePartition, CategoryType.ApiKeys, ActivityType.ApiKeys_KeyGenerated, "API Key '" + apiKey + "' regenerated. New key: '" + newKey + "'", requesterName + " regenerated previous api key to '" + newKey + "'", requesterId, requesterName, requesterEmail); } catch { } } #endregion return(newKey); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); NavPaneDivider.Visibility = Visibility.Collapsed; //ViewModel handles the navigation to the 0 index on startup so have to manually set this here. if (!CrossSecureStorage.Current.HasKey("OAuthToken")) { await ApiKeysManager.KeyRetriever(); } }
public List <ApiKeyModel> GetApiKeys(string accountNameKey, string sharedClientKey) { // Ensure the clients are certified. if (sharedClientKey != Sahara.Core.Platform.Requests.RequestManager.SharedClientKey) { return(null); } //Get ACCOUNT var account = AccountManager.GetAccount(accountNameKey, true, AccountManager.AccountIdentificationType.AccountName); return(ApiKeysManager.GetApiKeys(account)); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); ApiKeysManager.KeyRetriever(); _webView = view.FindViewById <WebView>(Resource.Id.login_webview); _webView.Settings.JavaScriptEnabled = true; //Values can be found at https://github.com/settings/applications _clientId = ApiKeysManager.GithubClientId; _clientSecret = ApiKeysManager.GithubClientSecret; _client = new GitHubClient(new ProductHeaderValue("gitit")); _webView.SetWebViewClient(new LoginWebViewClient(_client, _clientId, _clientSecret, _webView)); var loginRequest = new OauthLoginRequest(_clientId) { Scopes = { "user", "notifications", "repo", "delete_repo", "gist", "admin:org" } }; var oAuthLoginUrl = _client.Oauth.GetGitHubLoginUrl(loginRequest); _webView.LoadUrl(oAuthLoginUrl.ToString()); }
private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; NavMenuList.SelectedIndex = 0; NavMenuList.SetSelectedItem(NavMenuList.Items[0] as NavMenuItem); if (!(Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported())) { FeedbackNavPaneButton.Visibility = Visibility.Collapsed; FeedbackEmailNavPaneButton.Visibility = Visibility.Visible; } NavPaneDivider.Visibility = Visibility.Collapsed; //ViewModel handles the navigation to the 0 index on startup so have to manually set this here. if (!CrossSecureStorage.Current.HasKey("OAuthToken")) { await ApiKeysManager.KeyRetriever(); } await ViewModel.LoadFragments(); await RegisterAppForStoreNotifications(); }