Skip to content

Commit

Permalink
PKCE support! Fixes evemondevteam#91.
Browse files Browse the repository at this point in the history
- Restore unintentionally deleted update events for character monitor header, fixes evemondevteam#98.
- Global apply name simplifications (convert Int64 to long and String to string)
  • Loading branch information
peterhaneve committed Oct 18, 2018
1 parent 8cc733c commit 3ccab63
Show file tree
Hide file tree
Showing 246 changed files with 1,217 additions and 1,005 deletions.
32 changes: 20 additions & 12 deletions src/EVEMon.Common/App.config
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="EVEMon.Common.CloudStorageServices.OneDrive.OneDriveCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="EVEMon.Common.CloudStorageServices.Dropbox.DropboxCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="EVEMon.Common.CloudStorageServices.CloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="EVEMon.Common.CloudStorageServices.OneDrive.OneDriveCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="EVEMon.Common.CloudStorageServices.Dropbox.DropboxCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="EVEMon.Common.CloudStorageServices.CloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="EVEMon.Common.CloudStorageServices.OneDrive.OneDriveCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="EVEMon.Common.CloudStorageServices.GoogleDrive.GoogleDriveCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="EVEMon.Common.CloudStorageServices.Dropbox.DropboxCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="EVEMon.Common.CloudStorageServices.OneDrive.OneDriveCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="EVEMon.Common.CloudStorageServices.GoogleDrive.GoogleDriveCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="EVEMon.Common.CloudStorageServices.Dropbox.DropboxCloudStorageServiceSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0"/>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.36.0.0" newVersion="1.36.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis.Core" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.36.0.0" newVersion="1.36.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static IEnumerable<CloudStorageServiceProvider> Providers
.Where(type => typeof(CloudStorageServiceProvider).IsAssignableFrom(type) &&
type.GetConstructor(Type.EmptyTypes) != null)
.Select(type => Activator.CreateInstance(type) as CloudStorageServiceProvider)
.Where(provider => !String.IsNullOrWhiteSpace(provider.Name) && provider.Enabled)
.Where(provider => !string.IsNullOrWhiteSpace(provider.Name) && provider.Enabled)
.OrderBy(provider => provider.Name);

/// <summary>
Expand Down Expand Up @@ -628,7 +628,7 @@ private static void SaveSettingsFile(CloudStorageServiceAPIFile result)
using (StreamReader reader = new StreamReader(Util.ZlibUncompress(response)))
content = await reader.ReadToEndAsync();

if (String.IsNullOrWhiteSpace(content))
if (string.IsNullOrWhiteSpace(content))
{
result.Error = new SerializableAPIError
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed class DropboxCloudStorageServiceProvider : CloudStorageServiceProv
/// <c>true</c> if the provider API credentials are stored; otherwise, <c>false</c>.
/// </value>
public override bool HasCredentialsStored
=> !String.IsNullOrEmpty(DropboxCloudStorageServiceSettings.Default.AccessToken);
=> !string.IsNullOrEmpty(DropboxCloudStorageServiceSettings.Default.AccessToken);

/// <summary>
/// Gets the settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override bool HasCredentialsStored
{
try
{
return !String.IsNullOrWhiteSpace(GetCredentialsPath(checkAuth: true));
return !string.IsNullOrWhiteSpace(GetCredentialsPath(checkAuth: true));
}
catch (APIException)
{
Expand Down Expand Up @@ -264,7 +264,7 @@ protected override async Task<SerializableAPIResult<CloudStorageServiceAPIFile>>
{
ResumableUpload<GoogleFile, GoogleFile> request;
GoogleFile fileMetadata = new GoogleFile { Name = SettingsFileNameWithoutExtension };
if (String.IsNullOrWhiteSpace(m_fileId))
if (string.IsNullOrWhiteSpace(m_fileId))
{
//Upload
fileMetadata.Parents = new List<string> { Spaces };
Expand Down Expand Up @@ -320,7 +320,7 @@ protected override async Task<SerializableAPIResult<CloudStorageServiceAPIFile>>
{
m_fileId = m_fileId ?? await GetFileIdAsync().ConfigureAwait(false);

if (String.IsNullOrWhiteSpace(m_fileId))
if (string.IsNullOrWhiteSpace(m_fileId))
throw new FileNotFoundException();

using (DriveService client = GetClient())
Expand Down Expand Up @@ -392,7 +392,7 @@ private static string GetCredentialsPath(bool checkAuth = false)
string certPath = Directory.GetParent(configuration.FilePath).Parent?.Parent?.FullName;

bool fileExists = false;
if (!String.IsNullOrWhiteSpace(certPath))
if (!string.IsNullOrWhiteSpace(certPath))
{
certPath = Path.Combine(certPath, CredentialsDirectory);
string filePath = Path.Combine(certPath, $"{typeof(TokenResponse).FullName}-{UserId}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public sealed class OneDriveCloudStorageServiceProvider : CloudStorageServicePro
/// <c>true</c> if the provider API credentials are stored; otherwise, <c>false</c>.
/// </value>
public override bool HasCredentialsStored
=> !String.IsNullOrEmpty(OneDriveCloudStorageServiceSettings.Default.RefreshToken);
=> !string.IsNullOrEmpty(OneDriveCloudStorageServiceSettings.Default.RefreshToken);

/// <summary>
/// Gets the settings.
Expand Down Expand Up @@ -101,7 +101,7 @@ protected override async Task<SerializableAPIResult<SerializableAPICredentials>>
{
m_result = new SerializableAPIResult<SerializableAPICredentials>();

await CheckAuthCodeAsync(String.Empty).ConfigureAwait(false);
await CheckAuthCodeAsync(string.Empty).ConfigureAwait(false);

return m_result;
}
Expand Down Expand Up @@ -217,7 +217,7 @@ protected override async Task<SerializableAPIResult<CloudStorageServiceAPIFile>>
using (OneDriveClient client = (OneDriveClient)await GetClient().ConfigureAwait(false))
using (Stream stream = Util.GetMemoryStream(content))
{
Item response = await (String.IsNullOrWhiteSpace(m_fileId)
Item response = await (string.IsNullOrWhiteSpace(m_fileId)
? client.Drive.Special.AppRoot
.ItemWithPath(Uri.EscapeUriString(SettingsFileNameWithoutExtension))
: client.Drive.Items[m_fileId])
Expand Down Expand Up @@ -254,7 +254,7 @@ protected override async Task<SerializableAPIResult<CloudStorageServiceAPIFile>>
{
m_fileId = m_fileId ?? await GetFileIdAsync().ConfigureAwait(false);

if (String.IsNullOrWhiteSpace(m_fileId))
if (string.IsNullOrWhiteSpace(m_fileId))
throw new FileNotFoundException();

using (OneDriveClient client = (OneDriveClient)await GetClient().ConfigureAwait(false))
Expand Down Expand Up @@ -332,7 +332,7 @@ private static async Task<IOneDriveClient> GetClient()
CredentialCache credentialCache = new CredentialCache();
string credentials = OneDriveCloudStorageServiceSettings.Default.Credentials;

if (!String.IsNullOrWhiteSpace(credentials))
if (!string.IsNullOrWhiteSpace(credentials))
credentialCache.InitializeCacheFromBlob(Encoding.Default.GetBytes(credentials));

IServiceInfoProvider serviceInfoProvider = new ServiceInfoProvider(new FormsWebAuthenticationUi())
Expand Down Expand Up @@ -365,7 +365,7 @@ private static async Task<string> GetFileIdAsync()
catch (OneDriveException exc)
{
if (exc.IsMatch(OneDriveErrorCode.ItemNotFound.ToString()))
return String.Empty;
return string.Empty;

throw;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace EVEMon.Common.Collections.Global
/// Represents the characters list
/// </summary>
[EnforceUIThreadAffinity]
public sealed class GlobalCharacterIdentityCollection : ReadonlyKeyedCollection<Int64, CharacterIdentity>
public sealed class GlobalCharacterIdentityCollection : ReadonlyKeyedCollection<long, CharacterIdentity>
{
/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using EVEMon.Common.Enumerations;
using EVEMon.Common.Extensions;
using EVEMon.Common.Models;
using EVEMon.Common.Net;
using EVEMon.Common.Notifications;
using EVEMon.Common.Serialization;
using EVEMon.Common.Serialization.Esi;
using EVEMon.Common.Serialization.Eve;
using EVEMon.Common.Service;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -128,8 +128,7 @@ internal void InvalidateAPIError()
/// <summary>
/// Notifies an SSO sign-in error.
/// </summary>
/// <param name="result">The result.</param>
internal void NotifySSOError(JsonResult<AccessResponse> result)
internal void NotifySSOError()
{
var notification = new NotificationEventArgs(null, NotificationCategory.
QueryingError)
Expand Down
5 changes: 4 additions & 1 deletion src/EVEMon.Common/Constants/NetworkConstants.resx
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,13 @@
<value>authorize/?response_type=code&amp;redirect_uri={0}&amp;client_id={3}&amp;scope={2}&amp;state={1}&amp;code_challenge_method=S256&amp;code_challenge={4}</value>
</data>
<data name="SSODefaultAppID" xml:space="preserve">
<value>NOTVALIDNOTVALID</value>
<value>05153596dde44fd8b0d60c0ad3b90c24</value>
<comment>PKCE mode</comment>
</data>
<data name="PostDataPKCEToken" xml:space="preserve">
<value>grant_type=authorization_code&amp;code={0}&amp;client_id={1}&amp;code_verifier={2}</value>
</data>
<data name="SSOBaseV2" xml:space="preserve">
<value>https://login.eveonline.com/v2/oauth/</value>
</data>
</root>
11 changes: 10 additions & 1 deletion src/EVEMon.Common/Constants/NetworkConstants1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/EVEMon.Common/Controls/CharacterPortrait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private Task UpdateCharacterFromEVECacheAsync()

// Search for the largest portrait
int bestSize = 0;
string bestFile = String.Empty;
string bestFile = string.Empty;
int charIDLength = m_character.CharacterID.ToString(CultureConstants.
InvariantCulture).Length;
foreach (FileInfo file in imageFilesInEveCache)
Expand Down
2 changes: 1 addition & 1 deletion src/EVEMon.Common/Controls/ColumnSelectWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void btnReset_Click(object sender, EventArgs e)
UpdateContent();
}

protected virtual string GetHeader(int key) => String.Empty;
protected virtual string GetHeader(int key) => string.Empty;

protected virtual IEnumerable<int> AllKeys => Enumerable.Empty<int>();

Expand Down
2 changes: 1 addition & 1 deletion src/EVEMon.Common/Controls/CustomComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected class Dropdown : Form

// Keeps track of whether checked item(s) changed, hence the value of the CheckedComboBox as a whole changed.
// This is simply done via maintaining the old string-representation of the value(s) and the new one and comparing them!
private string oldStrValue = String.Empty;
private string oldStrValue = string.Empty;

public bool ValueChanged
{
Expand Down
8 changes: 4 additions & 4 deletions src/EVEMon.Common/Controls/DraggableListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ protected override void OnDragOver(DragEventArgs e)
}

base.OnDragOver(e);
String text = (String)e.Data.GetData(Reorder.GetType());
if (String.Compare(text, Reorder, StringComparison.CurrentCulture) == 0)
string text = (string)e.Data.GetData(Reorder.GetType());
if (string.Compare(text, Reorder, StringComparison.CurrentCulture) == 0)
{
e.Effect = DragDropEffects.Move;
hoverItem.EnsureVisible();
Expand Down Expand Up @@ -230,8 +230,8 @@ protected override void OnDragEnter(DragEventArgs e)
}

base.OnDragEnter(e);
String text = (String)e.Data.GetData(Reorder.GetType());
if (String.Compare(text, Reorder, StringComparison.CurrentCulture) == 0)
string text = (string)e.Data.GetData(Reorder.GetType());
if (string.Compare(text, Reorder, StringComparison.CurrentCulture) == 0)
e.Effect = DragDropEffects.Move;
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/EVEMon.Common/Controls/DropDownMouseMoveComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected override void OnSelectionChangeCommitted(EventArgs e)
/// Gets the text to display.
/// </summary>
/// <returns></returns>
public override string GetTextValue() => m_listBox.SelectedItem?.ToString() ?? String.Empty;
public override string GetTextValue() => m_listBox.SelectedItem?.ToString() ?? string.Empty;

/// <summary>
/// When the drop down is closed, we hide the tooltip.
Expand Down Expand Up @@ -236,7 +236,7 @@ private void ToolTipComboBox_DrawItem(object sender, DrawItemEventArgs e)
}

// Display text
if (!String.IsNullOrEmpty(m_displayText))
if (!string.IsNullOrEmpty(m_displayText))
{
using (Brush foreBrush = new SolidBrush(ForeColor))
{
Expand Down
4 changes: 2 additions & 2 deletions src/EVEMon.Common/Controls/EVEMonForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void SaveLocation()
if (!m_loaded)
return;

if (String.IsNullOrEmpty(RememberPositionKey))
if (string.IsNullOrEmpty(RememberPositionKey))
return;

Rectangle r = new Rectangle(Location, Size);
Expand All @@ -101,7 +101,7 @@ private void SaveLocation()
/// </summary>
private void RestoreLocation()
{
if (String.IsNullOrEmpty(RememberPositionKey))
if (string.IsNullOrEmpty(RememberPositionKey))
return;

List<Form> formList = Application.OpenForms.Cast<Form>().Where(form => form.GetType() == GetType()).ToList();
Expand Down
2 changes: 1 addition & 1 deletion src/EVEMon.Common/Controls/EveImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ private async Task GetImageFromCCPAsync(bool useFallbackUri = false)
/// <returns></returns>
private Uri GetImageUrl(bool useFallbackUri)
{
string path = String.Format(CultureConstants.InvariantCulture,
string path = string.Format(CultureConstants.InvariantCulture,
NetworkConstants.CCPIconsFromImageServer,
(int)m_imageSize > 64 ? "render" : "type",
m_item.ID, (int)m_imageSize);
Expand Down
2 changes: 1 addition & 1 deletion src/EVEMon.Common/Controls/ExpandablePanelControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ExpandablePanelControl()
{
components = new Container();

HeaderText = String.Empty;
HeaderText = string.Empty;
ExpandDirection = Direction.Up;

// Header
Expand Down
2 changes: 1 addition & 1 deletion src/EVEMon.Common/Controls/InfiniteDisplayToolTip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void Show(string text, Point pt)
public void Hide()
{
Hide(m_owner);
m_text = String.Empty;
m_text = string.Empty;
m_initialDelayTimer.Stop();
}
}
Expand Down
Loading

0 comments on commit 3ccab63

Please sign in to comment.