diff --git a/Assets/head_css.html b/Assets/head_css.html index a3c9fcf..17f3830 100644 --- a/Assets/head_css.html +++ b/Assets/head_css.html @@ -1,18 +1,17 @@ diff --git a/Bitbucket.Authentication.Test/packages.config b/Bitbucket.Authentication.Test/packages.config index 2791398..b0e72cb 100644 --- a/Bitbucket.Authentication.Test/packages.config +++ b/Bitbucket.Authentication.Test/packages.config @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/Bitbucket.Authentication/App.xaml.cs b/Bitbucket.Authentication/App.xaml.cs index 6e8f2d9..6c8d420 100644 --- a/Bitbucket.Authentication/App.xaml.cs +++ b/Bitbucket.Authentication/App.xaml.cs @@ -31,7 +31,7 @@ namespace Atlassian.Bitbucket.Authentication /// Dummy Application used to load the AppResources.xaml and keep the WPF designer happy while /// keeping this project as a Library rather than an Windows.Application. /// - public partial class App: Application + public partial class App : Application { } } diff --git a/Bitbucket.Authentication/Authentication.cs b/Bitbucket.Authentication/Authentication.cs index 185cee0..9633725 100644 --- a/Bitbucket.Authentication/Authentication.cs +++ b/Bitbucket.Authentication/Authentication.cs @@ -36,7 +36,7 @@ namespace Atlassian.Bitbucket.Authentication /// and providing functionality to manage credentials for Bitbucket /// hosting service. /// - public class Authentication: BaseAuthentication, IAuthentication + public class Authentication : BaseAuthentication, IAuthentication { public const string BitbucketBaseUrlHost = "bitbucket.org"; @@ -106,7 +106,8 @@ namespace Atlassian.Bitbucket.Authentication Trace.WriteLine($"host refresh credentials deleted for {refreshTargetUri.ActualUri}"); } - // if we deleted per user then we shoudl try and delete the host level credentials too if they match the username + // if we deleted per user then we shoudl try and delete the host level credentials too if + // they match the username if (targetUri.TargetUriContainsUsername) { var hostTargetUri = targetUri.GetHostTargetUri(); @@ -436,7 +437,6 @@ namespace Atlassian.Bitbucket.Authentication userSpecificTargetUri = targetUri.GetPerUserTargetUri(username); } - if (await BitbucketAuthority.ValidateCredentials(userSpecificTargetUri, username, credentials)) { return credentials; diff --git a/Bitbucket.Authentication/AuthenticationResult.cs b/Bitbucket.Authentication/AuthenticationResult.cs index bd2e919..a0f9a83 100644 --- a/Bitbucket.Authentication/AuthenticationResult.cs +++ b/Bitbucket.Authentication/AuthenticationResult.cs @@ -91,7 +91,7 @@ namespace Atlassian.Bitbucket.Authentication public string RemoteUsername { get; internal set; } /// - /// Flag indicating if the results is a success + /// Flag indicating if the results is a success /// public bool IsSuccess { get { return Type.Equals(AuthenticationResultType.Success); } } diff --git a/Bitbucket.Authentication/Authority.cs b/Bitbucket.Authentication/Authority.cs index 8de1969..518b55c 100644 --- a/Bitbucket.Authentication/Authority.cs +++ b/Bitbucket.Authentication/Authority.cs @@ -24,8 +24,6 @@ **/ using System; -using System.Net; -using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -40,7 +38,7 @@ namespace Atlassian.Bitbucket.Authentication /// Implementation of representing the Bitbucket APIs as the authority /// that can provide and validate credentials for Bitbucket. /// - internal class Authority: IAuthority + internal class Authority : IAuthority { /// /// The root URL for Bitbucket REST API calls. @@ -87,7 +85,7 @@ namespace Atlassian.Bitbucket.Authentication var authHeader = GetBearerHeaderAuthHeader(result.Token.Value); var userResult = await RestClient.TryGetUser(targetUri, RequestTimeout, restRootUri, authHeader); - if(!userResult.IsSuccess) + if (!userResult.IsSuccess) { Trace.WriteLine($"oauth user check failed"); return new AuthenticationResult(AuthenticationResultType.Failure); @@ -102,7 +100,6 @@ namespace Atlassian.Bitbucket.Authentication // everything is hunky dory return result; - } catch (Exception ex) { @@ -178,7 +175,7 @@ namespace Atlassian.Bitbucket.Authentication } /// - /// Get the HTTP encoded version of the Credentials secret + /// Get the HTTP encoded version of the Credentials secret /// private static string GetEncodedCredentials(string username, Credential credentials) { @@ -188,7 +185,7 @@ namespace Atlassian.Bitbucket.Authentication } /// - /// Get the HTTP encoded version of the Credentials secret + /// Get the HTTP encoded version of the Credentials secret /// private static string GetEncodedCredentials(string user, string password) { diff --git a/Bitbucket.Authentication/BasicAuth/BasicAuthAuthenticator.cs b/Bitbucket.Authentication/BasicAuth/BasicAuthAuthenticator.cs index e27bf3b..b5e6771 100644 --- a/Bitbucket.Authentication/BasicAuth/BasicAuthAuthenticator.cs +++ b/Bitbucket.Authentication/BasicAuth/BasicAuthAuthenticator.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; using System.Text; -using System.Threading; using System.Threading.Tasks; using Atlassian.Bitbucket.Authentication.Rest; using Microsoft.Alm.Authentication; @@ -12,13 +7,13 @@ using Microsoft.Alm.Git; namespace Atlassian.Bitbucket.Authentication.BasicAuth { - class BasicAuthAuthenticator + internal class BasicAuthAuthenticator { public async Task GetAuthAsync(TargetUri targetUri, TokenScope scope, int requestTimeout, Uri restRootUrl, string username, string password) { // use the provided username and password and attempt a Basic Auth request to a known // REST API resource. - + string basicAuthValue = string.Format("{0}:{1}", username, password); byte[] authBytes = Encoding.UTF8.GetBytes(basicAuthValue); basicAuthValue = Convert.ToBase64String(authBytes); @@ -28,11 +23,10 @@ namespace Atlassian.Bitbucket.Authentication.BasicAuth if (result.Type.Equals(AuthenticationResultType.Success)) { - // Success with username/passord indicates 2FA is not on so - // the 'token' is actually the password if we had a - // successful call then the password is good. + // Success with username/passord indicates 2FA is not on so the 'token' is actually + // the password if we had a successful call then the password is good. var token = new Token(password, TokenType.Personal); - if(!string.IsNullOrWhiteSpace(result.RemoteUsername) && !username.Equals(result.RemoteUsername)) + if (!string.IsNullOrWhiteSpace(result.RemoteUsername) && !username.Equals(result.RemoteUsername)) { Trace.WriteLine($"Remote username [{result.RemoteUsername}] != [{username}] supplied username"); return new AuthenticationResult(AuthenticationResultType.Success, token, result.RemoteUsername); diff --git a/Bitbucket.Authentication/Controls/CredentialsControl.xaml b/Bitbucket.Authentication/Controls/CredentialsControl.xaml index 77fc6bb..93aeb12 100644 --- a/Bitbucket.Authentication/Controls/CredentialsControl.xaml +++ b/Bitbucket.Authentication/Controls/CredentialsControl.xaml @@ -24,7 +24,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." **/ --> - /// Defines the UI used to prompt users for username/password credentials for Bitbucket accounts. /// - public partial class CredentialsControl: DialogUserControl + public partial class CredentialsControl : DialogUserControl { public CredentialsControl() { diff --git a/Bitbucket.Authentication/Controls/HorizontalShadowDivider.xaml b/Bitbucket.Authentication/Controls/HorizontalShadowDivider.xaml index bb27cf9..48ace6c 100644 --- a/Bitbucket.Authentication/Controls/HorizontalShadowDivider.xaml +++ b/Bitbucket.Authentication/Controls/HorizontalShadowDivider.xaml @@ -24,7 +24,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." **/ --> - - /// Defines the UI used to prompt a user to run the OAuth authorization process. /// - public partial class OAuthControl: DialogUserControl + public partial class OAuthControl : DialogUserControl { public OAuthControl() { diff --git a/Bitbucket.Authentication/Controls/Text/ValidationMessage.cs b/Bitbucket.Authentication/Controls/Text/ValidationMessage.cs index 3c0c9ca..d822e89 100644 --- a/Bitbucket.Authentication/Controls/Text/ValidationMessage.cs +++ b/Bitbucket.Authentication/Controls/Text/ValidationMessage.cs @@ -32,7 +32,7 @@ using GitHub.Shared.ViewModels.Validation; namespace Atlassian.Bitbucket.Authentication.Controls { - public class ValidationMessage: UserControl + public class ValidationMessage : UserControl { private const double defaultTextChangeThrottle = 0.2; diff --git a/Bitbucket.Authentication/Rest/RestClient.cs b/Bitbucket.Authentication/Rest/RestClient.cs index fb403e6..cec1168 100644 --- a/Bitbucket.Authentication/Rest/RestClient.cs +++ b/Bitbucket.Authentication/Rest/RestClient.cs @@ -34,29 +34,29 @@ namespace Atlassian.Bitbucket.Authentication.Rest { case HttpStatusCode.OK: case HttpStatusCode.Created: - { - Trace.WriteLine("authentication success: new password token created."); + { + Trace.WriteLine("authentication success: new password token created."); // Get useername to cross check against supplied one - var responseText = await response.Content.ReadAsStringAsync(); - var username = FindUsername(responseText); - return new AuthenticationResult(AuthenticationResultType.Success, username); - } + var responseText = await response.Content.ReadAsStringAsync(); + var username = FindUsername(responseText); + return new AuthenticationResult(AuthenticationResultType.Success, username); + } case HttpStatusCode.Forbidden: - { - // A 403/Forbidden response indicates the username/password - // are recognized and good but 2FA is on in which case we - // want to indicate that with the TwoFactor result - Trace.WriteLine("two-factor app authentication code required"); - return new AuthenticationResult(AuthenticationResultType.TwoFactor); - } + { + // A 403/Forbidden response indicates the username/password are + // recognized and good but 2FA is on in which case we want to + // indicate that with the TwoFactor result + Trace.WriteLine("two-factor app authentication code required"); + return new AuthenticationResult(AuthenticationResultType.TwoFactor); + } case HttpStatusCode.Unauthorized: - { - // username or password are wrong. - Trace.WriteLine("authentication unauthorised"); - return new AuthenticationResult(AuthenticationResultType.Failure); - } + { + // username or password are wrong. + Trace.WriteLine("authentication unauthorised"); + return new AuthenticationResult(AuthenticationResultType.Failure); + } default: // any unexpected result can be treated as a failure. @@ -82,4 +82,4 @@ namespace Atlassian.Bitbucket.Authentication.Rest return null; } } -} \ No newline at end of file +} diff --git a/Bitbucket.Authentication/TokenScope.cs b/Bitbucket.Authentication/TokenScope.cs index b2772fc..5524fae 100644 --- a/Bitbucket.Authentication/TokenScope.cs +++ b/Bitbucket.Authentication/TokenScope.cs @@ -24,7 +24,6 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." **/ -using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using ScopeSet = System.Collections.Generic.HashSet; @@ -34,7 +33,7 @@ namespace Atlassian.Bitbucket.Authentication /// /// Defines the available scopes associated with OAuth tokens in Bitbucket. /// - public sealed class TokenScope: Microsoft.Alm.Authentication.TokenScope + public sealed class TokenScope : Microsoft.Alm.Authentication.TokenScope { public static readonly TokenScope None = new TokenScope(string.Empty); diff --git a/Bitbucket.Authentication/ViewModels/CredentialsViewModel.cs b/Bitbucket.Authentication/ViewModels/CredentialsViewModel.cs index fd6c771..ec71b4f 100644 --- a/Bitbucket.Authentication/ViewModels/CredentialsViewModel.cs +++ b/Bitbucket.Authentication/ViewModels/CredentialsViewModel.cs @@ -34,7 +34,7 @@ namespace Atlassian.Bitbucket.Authentication.ViewModels /// /// The ViewModel behind the Basic Auth username/password UI prompt. /// - public class CredentialsViewModel: DialogViewModel + public class CredentialsViewModel : DialogViewModel { public CredentialsViewModel() : this(string.Empty) { diff --git a/Bitbucket.Authentication/ViewModels/OAuthViewModel.cs b/Bitbucket.Authentication/ViewModels/OAuthViewModel.cs index 57be4d5..9f7fddb 100644 --- a/Bitbucket.Authentication/ViewModels/OAuthViewModel.cs +++ b/Bitbucket.Authentication/ViewModels/OAuthViewModel.cs @@ -32,7 +32,7 @@ namespace Atlassian.Bitbucket.Authentication.ViewModels /// /// The ViewModel behind the OAuth UI prompt /// - public class OAuthViewModel: DialogViewModel + public class OAuthViewModel : DialogViewModel { private bool _resultType; diff --git a/Bitbucket.Authentication/Views/CredentialsWindow.xaml b/Bitbucket.Authentication/Views/CredentialsWindow.xaml index fb4634d..6f3e152 100644 --- a/Bitbucket.Authentication/Views/CredentialsWindow.xaml +++ b/Bitbucket.Authentication/Views/CredentialsWindow.xaml @@ -24,7 +24,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." **/ --> -. /// /// - partial class CredentialsWindow: AuthenticationDialogWindow + partial class CredentialsWindow : AuthenticationDialogWindow { public CredentialsWindow() { diff --git a/Bitbucket.Authentication/Views/OAuthWindow.xaml.cs b/Bitbucket.Authentication/Views/OAuthWindow.xaml.cs index 503bf24..f0bf64e 100644 --- a/Bitbucket.Authentication/Views/OAuthWindow.xaml.cs +++ b/Bitbucket.Authentication/Views/OAuthWindow.xaml.cs @@ -35,7 +35,7 @@ namespace Atlassian.Bitbucket.Authentication.Views /// enabled on their account. Prompts the user to run the OAuth authorization process. /// /// - public partial class OAuthWindow: AuthenticationDialogWindow + public partial class OAuthWindow : AuthenticationDialogWindow { public OAuthWindow() { diff --git a/Bitbucket.Authentication/packages.config b/Bitbucket.Authentication/packages.config index 1a26b3d..b465822 100644 --- a/Bitbucket.Authentication/packages.config +++ b/Bitbucket.Authentication/packages.config @@ -1,4 +1,4 @@  - \ No newline at end of file + diff --git a/Cli-Askpass/PasswordBoxHintAdorner.cs b/Cli-Askpass/PasswordBoxHintAdorner.cs index 1c50d87..94bb282 100644 --- a/Cli-Askpass/PasswordBoxHintAdorner.cs +++ b/Cli-Askpass/PasswordBoxHintAdorner.cs @@ -32,7 +32,7 @@ using System.Windows.Media; namespace Microsoft.Alm.Gui { [System.Runtime.InteropServices.ComVisible(false)] - public class PasswordBoxHintAdorner: Adorner + public class PasswordBoxHintAdorner : Adorner { public PasswordBoxHintAdorner(UIElement adornedElement, string hintText, Style hintStyle, VisibilityDelegate visibilityCallback) : base(adornedElement) diff --git a/Cli-Askpass/Program.cs b/Cli-Askpass/Program.cs index e2b2308..aeb01dc 100644 --- a/Cli-Askpass/Program.cs +++ b/Cli-Askpass/Program.cs @@ -51,16 +51,16 @@ namespace Microsoft.Alm.Cli internal static bool TryParseUrlCredentials(string targetUrl, out string username, out string password) { - // config stored credentials come in the format of [:]@ - // with password being optional scheme terminator is actually "://" so we need - // adjust to get the correct index + // config stored credentials come in the format of [:]@ with + // password being optional scheme terminator is actually "://" so we need adjust to get + // the correct index int schemeTerminator = targetUrl.IndexOf(':') + 2; int credentialTerminator = targetUrl.IndexOf('@', schemeTerminator + 1); if (credentialTerminator > 0) { - // only check within the credential portion of the url, don't look past the - // '@' because the port token is the same as the username / password seperator. + // only check within the credential portion of the url, don't look past the '@' + // because the port token is the same as the username / password seperator. int credentialLength = credentialTerminator - schemeTerminator; credentialLength = Math.Max(0, credentialLength); diff --git a/Cli-Askpass/UserPromptDialog.xaml.cs b/Cli-Askpass/UserPromptDialog.xaml.cs index d93d064..1ecc519 100644 --- a/Cli-Askpass/UserPromptDialog.xaml.cs +++ b/Cli-Askpass/UserPromptDialog.xaml.cs @@ -33,7 +33,7 @@ namespace Microsoft.Alm.Gui /// Interaction logic for PassphraseWindow.xaml /// [System.Runtime.InteropServices.ComVisible(false)] - public partial class UserPromptDialog: Window + public partial class UserPromptDialog : Window { public const string HintTextPassphrase = "SSH Passphrase"; public const string HintTextPassword = "Password"; diff --git a/Cli-Askpass/packages.config b/Cli-Askpass/packages.config index 1a26b3d..b465822 100644 --- a/Cli-Askpass/packages.config +++ b/Cli-Askpass/packages.config @@ -1,4 +1,4 @@  - \ No newline at end of file + diff --git a/Cli-CredentialHelper.Test/packages.config b/Cli-CredentialHelper.Test/packages.config index 92e390a..de3c2ec 100644 --- a/Cli-CredentialHelper.Test/packages.config +++ b/Cli-CredentialHelper.Test/packages.config @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/Cli-CredentialHelper/Installer.cs b/Cli-CredentialHelper/Installer.cs index 50c9250..c58d209 100644 --- a/Cli-CredentialHelper/Installer.cs +++ b/Cli-CredentialHelper/Installer.cs @@ -1037,7 +1037,7 @@ namespace Microsoft.Alm.Cli } } - public enum ResultValue: int + public enum ResultValue : int { UnknownFailure = -1, Success = 0, diff --git a/Cli-CredentialHelper/packages.config b/Cli-CredentialHelper/packages.config index 1a26b3d..b465822 100644 --- a/Cli-CredentialHelper/packages.config +++ b/Cli-CredentialHelper/packages.config @@ -1,4 +1,4 @@  - \ No newline at end of file + diff --git a/Cli-Shared/Delegates.cs b/Cli-Shared/Delegates.cs index c71bbe0..4ae098e 100644 --- a/Cli-Shared/Delegates.cs +++ b/Cli-Shared/Delegates.cs @@ -35,19 +35,33 @@ namespace Microsoft.Alm.Cli partial class Program { internal delegate Credential BasicCredentialPromptDelegate(Program program, TargetUri targetUri, string titleMessage); + internal delegate bool BitbucketCredentialPromptDelegate(Program program, string titleMessage, TargetUri targetUri, out string username, out string password); + internal delegate bool BitbucketOAuthPromptDelegate(Program program, string title, TargetUri targetUri, Bitbucket.AuthenticationResultType resultType, string username); + internal delegate Task CreateAuthenticationDelegate(Program program, OperationArguments operationArguments); + internal delegate void DeleteCredentialsDelegate(Program program, OperationArguments operationArguments); + internal delegate void DieExceptionDelegate(Program program, Exception exception, string path, int line, string name); + internal delegate void DieMessageDelegate(Program program, string message, string path, int line, string name); + internal delegate void EnableTraceLoggingDelegate(Program program, OperationArguments operationArguments); + internal delegate void EnableTraceLoggingFileDelegate(Program program, OperationArguments operationArguments, string logFilePath); + internal delegate void ExitDelegate(Program program, int exitcode, string message, string path, int line, string name); + internal delegate bool GitHubAuthCodePromptDelegate(Program program, TargetUri targetUri, Github.GitHubAuthenticationResultType resultType, string username, out string authenticationCode); + internal delegate bool GitHubCredentialPromptDelegate(Program program, TargetUri targetUri, out string username, out string password); + internal delegate void LoadOperationArgumentsDelegate(Program program, OperationArguments operationArguments); + internal delegate void LogEventDelegate(Program program, string message, EventLogEntryType eventType); + internal delegate bool ModalPromptDisplayDialogDelegate(Program program, ref NativeMethods.CredentialUiInfo credUiInfo, ref NativeMethods.CredentialPackFlags authPackage, @@ -59,15 +73,25 @@ namespace Microsoft.Alm.Cli NativeMethods.CredentialUiWindowsFlags flags, out string username, out string password); + internal delegate Credential ModalPromptForCredentialsDelegate(Program program, TargetUri targetUri, string message); + internal delegate Credential ModalPromptForPasswordDelegate(Program program, TargetUri targetUri, string message, string username); + internal delegate void PrintArgsDelegate(Program program, string[] args); + internal delegate Credential QueryCredentialsDelegate(Program program, OperationArguments operationArguments); + internal delegate ConsoleKeyInfo ReadKeyDelegate(Program program, bool intercept); + internal delegate bool StandardHandleIsTtyDelegate(Program program, NativeMethods.StandardHandleType handleType); + internal delegate bool TryReadBooleanDelegate(Program program, OperationArguments operationArguments, string configKey, string environKey, out bool? value); + internal delegate bool TryReadStringDelegate(Program program, OperationArguments operationArguments, string configKey, string environKey, out string value); + internal delegate void WriteDelegate(Program program, string message); + internal delegate void WriteLineDelegate(Program program, string message); } } diff --git a/Cli-Shared/Functions/Common.cs b/Cli-Shared/Functions/Common.cs index 5e1b63d..aa03736 100644 --- a/Cli-Shared/Functions/Common.cs +++ b/Cli-Shared/Functions/Common.cs @@ -554,8 +554,8 @@ namespace Microsoft.Alm.Cli && (credentials = await basicAuth.AcquireCredentials(operationArguments.TargetUri)) != null)) { Git.Trace.WriteLine("credentials found."); - // no need to save the credentials explicitly, as Git will call back with - // a store command if the credentials are valid. + // no need to save the credentials explicitly, as Git will call back + // with a store command if the credentials are valid. } else { diff --git a/Cli-Shared/NativeMethods.cs b/Cli-Shared/NativeMethods.cs index e28780c..568a7a7 100644 --- a/Cli-Shared/NativeMethods.cs +++ b/Cli-Shared/NativeMethods.cs @@ -40,7 +40,7 @@ namespace Microsoft.Alm private const string Kernel32 = "kernel32.dll"; [Flags] - public enum ConsoleMode: uint + public enum ConsoleMode : uint { /// /// CTRL+C is processed by the system and is not placed in the input buffer. If the input @@ -112,7 +112,7 @@ namespace Microsoft.Alm } [Flags] - public enum FileAccess: uint + public enum FileAccess : uint { GenericRead = 0x80000000, GenericWrite = 0x40000000, @@ -121,7 +121,7 @@ namespace Microsoft.Alm } [Flags] - public enum FileAttributes: uint + public enum FileAttributes : uint { /// /// The file is read only. Applications can read the file, but cannot write to or delete it. @@ -289,7 +289,7 @@ namespace Microsoft.Alm WriteThrough = 0x80000000, } - public enum FileCreationDisposition: uint + public enum FileCreationDisposition : uint { /// /// Creates a new file, only if it does not already exist. @@ -345,7 +345,7 @@ namespace Microsoft.Alm } [Flags] - public enum FileShare: uint + public enum FileShare : uint { /// /// Prevents other processes from opening a file or device if they request delete, read, @@ -381,7 +381,7 @@ namespace Microsoft.Alm Delete = 0x00000004 } - public enum FileType: uint + public enum FileType : uint { /// /// Either the type of the specified file is unknown, or the function failed. @@ -405,7 +405,7 @@ namespace Microsoft.Alm Remote = 0x8000, }; - public enum StandardHandleType: int + public enum StandardHandleType : int { /// /// The standard input device. Initially, this is the console input buffer, CONIN$. @@ -422,7 +422,7 @@ namespace Microsoft.Alm }; [Flags] - public enum CredentialPackFlags: uint + public enum CredentialPackFlags : uint { None = 0, ProtectedCredentials = 0x1, @@ -430,7 +430,7 @@ namespace Microsoft.Alm GenericCredentials = 0x4, } - internal enum CredentialType: uint + internal enum CredentialType : uint { /// The `` is a generic credential. The /// credential will not be used by any particular authentication package. @@ -504,7 +504,7 @@ namespace Microsoft.Alm } [Flags] - public enum CredentialUiFlags: uint + public enum CredentialUiFlags : uint { None = 0, IncorrectPassword = 0x1, @@ -526,7 +526,7 @@ namespace Microsoft.Alm KeepUsername = 0x100000, } - public enum CredentialUiResult: uint + public enum CredentialUiResult : uint { Success = 0, Cancelled = 1223, @@ -539,7 +539,7 @@ namespace Microsoft.Alm } [Flags] - public enum CredentialUiWindowsFlags: uint + public enum CredentialUiWindowsFlags : uint { None = 0, /// diff --git a/Cli-Shared/OperationArguments.cs b/Cli-Shared/OperationArguments.cs index 792b326..4db4992 100644 --- a/Cli-Shared/OperationArguments.cs +++ b/Cli-Shared/OperationArguments.cs @@ -200,84 +200,80 @@ namespace Microsoft.Alm.Cli if (readableStream == Stream.Null || !readableStream.CanRead) throw new InvalidOperationException("Unable to read input."); - else + byte[] buffer = new byte[4096]; + int read = 0; + + int r; + while ((r = readableStream.Read(buffer, read, buffer.Length - read)) > 0) { - // - byte[] buffer = new byte[4096]; - int read = 0; + read += r; - int r; - while ((r = readableStream.Read(buffer, read, buffer.Length - read)) > 0) + // if we've filled the buffer, make it larger this could hit an out of memory + // condition, but that'd require the called to be attempting to do so, since + // that's not a secyity threat we can safely ignore that and allow NetFx to + // handle it + if (read == buffer.Length) { - read += r; - - // if we've filled the buffer, make it larger this could hit an out of memory - // condition, but that'd require the called to be attempting to do so, since - // that's not a secyity threat we can safely ignore that and allow NetFx to - // handle it - if (read == buffer.Length) - { - Array.Resize(ref buffer, buffer.Length * 2); - } - - if ((read > 0 && read < 3 && buffer[read - 1] == '\n')) - { - throw new InvalidDataException("Invalid input, please see 'https://www.kernel.org/pub/software/scm/git/docs/git-credential.html'."); - } - - // the input ends with LFLF, check for that and break the read loop unless - // input is coming from CLRF system, in which case it'll be CLRFCLRF - if ((buffer[read - 2] == '\n' - && buffer[read - 1] == '\n') - || (buffer[read - 4] == '\r' - && buffer[read - 3] == '\n' - && buffer[read - 2] == '\r' - && buffer[read - 1] == '\n')) - break; + Array.Resize(ref buffer, buffer.Length * 2); } - // Git uses UTF-8 for string, don't let the OS decide how to decode it instead - // we'll actively decode the UTF-8 block ourselves - string input = Encoding.UTF8.GetString(buffer, 0, read); - - // the `StringReader` is just useful - using (StringReader reader = new StringReader(input)) + if ((read > 0 && read < 3 && buffer[read - 1] == '\n')) { - string line; - while (!string.IsNullOrWhiteSpace((line = reader.ReadLine()))) + throw new InvalidDataException("Invalid input, please see 'https://www.kernel.org/pub/software/scm/git/docs/git-credential.html'."); + } + + // the input ends with LFLF, check for that and break the read loop unless + // input is coming from CLRF system, in which case it'll be CLRFCLRF + if ((buffer[read - 2] == '\n' + && buffer[read - 1] == '\n') + || (buffer[read - 4] == '\r' + && buffer[read - 3] == '\n' + && buffer[read - 2] == '\r' + && buffer[read - 1] == '\n')) + break; + } + + // Git uses UTF-8 for string, don't let the OS decide how to decode it instead + // we'll actively decode the UTF-8 block ourselves + string input = Encoding.UTF8.GetString(buffer, 0, read); + + // the `StringReader` is just useful + using (StringReader reader = new StringReader(input)) + { + string line; + while (!string.IsNullOrWhiteSpace((line = reader.ReadLine()))) + { + string[] pair = line.Split(new[] { '=' }, 2); + + if (pair.Length == 2) { - string[] pair = line.Split(new[] { '=' }, 2); - - if (pair.Length == 2) + switch (pair[0]) { - switch (pair[0]) - { - case "protocol": - _queryProtocol = pair[1]; - break; + case "protocol": + _queryProtocol = pair[1]; + break; - case "host": - _queryHost = pair[1]; - break; + case "host": + _queryHost = pair[1]; + break; - case "path": - _queryPath = pair[1]; - break; + case "path": + _queryPath = pair[1]; + break; - case "username": - _username = pair[1]; - break; + case "username": + _username = pair[1]; + break; - case "password": - _password = pair[1]; - break; - } + case "password": + _password = pair[1]; + break; } } } - - CreateTargetUri(); } + + CreateTargetUri(); } internal Impl(Uri targetUri) diff --git a/Cli-Shared/Program.cs b/Cli-Shared/Program.cs index 6379aec..29085c3 100644 --- a/Cli-Shared/Program.cs +++ b/Cli-Shared/Program.cs @@ -1,3 +1,28 @@ +/**** Git Credential Manager for Windows **** + * + * Copyright (c) Microsoft Corporation + * All rights reserved. + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the """"Software""""), to deal + * in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +**/ + using System; using System.Diagnostics; using System.IO; diff --git a/GitHub.Authentication.Test/GlobalSuppressions.cs b/GitHub.Authentication.Test/GlobalSuppressions.cs index 32546d4..5543f46 100644 Binary files a/GitHub.Authentication.Test/GlobalSuppressions.cs and b/GitHub.Authentication.Test/GlobalSuppressions.cs differ diff --git a/GitHub.Authentication.Test/Properties/AssemblyInfo.cs b/GitHub.Authentication.Test/Properties/AssemblyInfo.cs index 6dfc4e4..78c0758 100644 --- a/GitHub.Authentication.Test/Properties/AssemblyInfo.cs +++ b/GitHub.Authentication.Test/Properties/AssemblyInfo.cs @@ -1,9 +1,8 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. +// General Information about an assembly is controlled through the following set of attributes. +// Change these attribute values to modify the information associated with an assembly. [assembly: AssemblyTitle("GitHub.Authentication.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -13,9 +12,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("Microsoft Corporation")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. +// Setting ComVisible to false makes the types in this assembly not visible to COM components. If you +// need to access a type in this assembly from COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM @@ -23,13 +21,9 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // -// Major Version -// Minor Version -// Build Number -// Revision +// Major Version Minor Version Build Number Revision // -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] +// You can specify all the values or you can default the Build and Revision Numbers by using the '*' +// as shown below: [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/GitHub.Authentication.Test/Validation/ValidatableTestObject.cs b/GitHub.Authentication.Test/Validation/ValidatableTestObject.cs index 320706b..fa96045 100644 --- a/GitHub.Authentication.Test/Validation/ValidatableTestObject.cs +++ b/GitHub.Authentication.Test/Validation/ValidatableTestObject.cs @@ -5,6 +5,7 @@ namespace GitHub.Authentication.Test.Validation public class ValidatableTestObject : ViewModel { private string _someStringProperty; + public string SomeStringProperty { get { return _someStringProperty; } @@ -16,6 +17,7 @@ namespace GitHub.Authentication.Test.Validation } private string _anotherStringProperty; + public string AnotherStringProperty { get { return _anotherStringProperty; } diff --git a/GitHub.Authentication.Test/Xunit/WpfFactAttribute.cs.cs b/GitHub.Authentication.Test/Xunit/WpfFactAttribute.cs.cs index 72bf0b1..c8a6aaf 100644 --- a/GitHub.Authentication.Test/Xunit/WpfFactAttribute.cs.cs +++ b/GitHub.Authentication.Test/Xunit/WpfFactAttribute.cs.cs @@ -1,4 +1,20 @@ -// Borrowed from: https://github.com/xunit/samples.xunit/blob/master/STAExamples/WpfFactAttribute.cs +/**** Git Credential Manager for Windows **** + * + * Copyright (c) .NET Foundation and Contributors + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ using System; using Xunit; diff --git a/GitHub.Authentication.Test/Xunit/WpfFactDiscoverer.cs b/GitHub.Authentication.Test/Xunit/WpfFactDiscoverer.cs index ae8c378..462cd72 100644 --- a/GitHub.Authentication.Test/Xunit/WpfFactDiscoverer.cs +++ b/GitHub.Authentication.Test/Xunit/WpfFactDiscoverer.cs @@ -1,4 +1,20 @@ -// Borrowed from: https://github.com/xunit/samples.xunit/blob/master/STAExamples/WpfFactDiscoverer.cs +/**** Git Credential Manager for Windows **** + * + * Copyright (c) .NET Foundation and Contributors + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ using System.Collections.Generic; using System.Linq; @@ -9,7 +25,7 @@ namespace Xunit { public class WpfFactDiscoverer : IXunitTestCaseDiscoverer { - readonly FactDiscoverer factDiscoverer; + private readonly FactDiscoverer factDiscoverer; public WpfFactDiscoverer(IMessageSink diagnosticMessageSink) { @@ -22,4 +38,4 @@ namespace Xunit .Select(testCase => new WpfTestCase(testCase)); } } -} \ No newline at end of file +} diff --git a/GitHub.Authentication.Test/Xunit/WpfTestCase.cs b/GitHub.Authentication.Test/Xunit/WpfTestCase.cs index e0718e1..90d5bcd 100644 --- a/GitHub.Authentication.Test/Xunit/WpfTestCase.cs +++ b/GitHub.Authentication.Test/Xunit/WpfTestCase.cs @@ -1,4 +1,20 @@ -// Borrowed from: https://github.com/xunit/samples.xunit/blob/master/STAExamples/WpfTestCase.cs +/**** Git Credential Manager for Windows **** + * + * Copyright (c) .NET Foundation and Contributors + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ using System; using System.Collections.Generic; @@ -7,7 +23,6 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using System.Windows.Threading; -using Xunit; using Xunit.Abstractions; using Xunit.Sdk; @@ -19,7 +34,7 @@ namespace Xunit [DebuggerDisplay(@"\{ class = {TestMethod.TestClass.Class.Name}, method = {TestMethod.Method.Name}, display = {DisplayName}, skip = {SkipReason} \}")] public class WpfTestCase : LongLivedMarshalByRefObject, IXunitTestCase { - IXunitTestCase testCase; + private IXunitTestCase testCase; public WpfTestCase(IXunitTestCase testCase) { @@ -27,6 +42,7 @@ namespace Xunit } /// + /// [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("Called by the de-serializer", error: true)] public WpfTestCase() { } @@ -47,8 +63,8 @@ namespace Xunit { try { - // Set up the SynchronizationContext so that any awaits - // resume on the STA thread as they would in a GUI app. + // Set up the SynchronizationContext so that any awaits resume on the STA thread + // as they would in a GUI app. SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); // Start off the test method. @@ -147,4 +163,4 @@ namespace Xunit tcs.SetResult(template.Result); } } -} \ No newline at end of file +} diff --git a/GitHub.Authentication.Test/Xunit/WpfTheoryAttribute.cs b/GitHub.Authentication.Test/Xunit/WpfTheoryAttribute.cs index 496be3e..ef71fd7 100644 --- a/GitHub.Authentication.Test/Xunit/WpfTheoryAttribute.cs +++ b/GitHub.Authentication.Test/Xunit/WpfTheoryAttribute.cs @@ -1,4 +1,20 @@ -// Borrowed from: https://github.com/xunit/samples.xunit/blob/master/STAExamples/WpfTheoryAttribute.cs +/**** Git Credential Manager for Windows **** + * + * Copyright (c) .NET Foundation and Contributors + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ using System; using Xunit; @@ -6,4 +22,4 @@ using Xunit.Sdk; [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] [XunitTestCaseDiscoverer("Xunit.WpfTheoryDiscoverer", "GitHub.Authentication.Test")] -public class WpfTheoryAttribute : TheoryAttribute { } \ No newline at end of file +public class WpfTheoryAttribute : TheoryAttribute { } diff --git a/GitHub.Authentication.Test/Xunit/WpfTheoryDiscoverer.cs b/GitHub.Authentication.Test/Xunit/WpfTheoryDiscoverer.cs index 0fd5227..e096c8c 100644 --- a/GitHub.Authentication.Test/Xunit/WpfTheoryDiscoverer.cs +++ b/GitHub.Authentication.Test/Xunit/WpfTheoryDiscoverer.cs @@ -1,4 +1,20 @@ -// Borrowed from: https://github.com/xunit/samples.xunit/blob/master/STAExamples/WpfTheoryDiscoverer.cs +/**** Git Credential Manager for Windows **** + * + * Copyright (c) .NET Foundation and Contributors + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ using System.Collections.Generic; using System.Linq; @@ -9,7 +25,7 @@ namespace Xunit { public class WpfTheoryDiscoverer : IXunitTestCaseDiscoverer { - readonly TheoryDiscoverer theoryDiscoverer; + private readonly TheoryDiscoverer theoryDiscoverer; public WpfTheoryDiscoverer(IMessageSink diagnosticMessageSink) { @@ -22,4 +38,4 @@ namespace Xunit .Select(testCase => new WpfTestCase(testCase)); } } -} \ No newline at end of file +} diff --git a/GitHub.Authentication.Test/packages.config b/GitHub.Authentication.Test/packages.config index 2791398..b0e72cb 100644 --- a/GitHub.Authentication.Test/packages.config +++ b/GitHub.Authentication.Test/packages.config @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/GitHub.Authentication/App.config b/GitHub.Authentication/App.config index e4ee724..4bb6359 100644 --- a/GitHub.Authentication/App.config +++ b/GitHub.Authentication/App.config @@ -1,6 +1,6 @@ - + diff --git a/GitHub.Authentication/App.xaml.cs b/GitHub.Authentication/App.xaml.cs index bcd3dfb..1f252c1 100644 --- a/GitHub.Authentication/App.xaml.cs +++ b/GitHub.Authentication/App.xaml.cs @@ -12,7 +12,7 @@ namespace GitHub.Authentication /// It does not shell out to this exe. The exe is here simply to make working on this dialog easy. /// /// - public partial class App: Application + public partial class App : Application { } } diff --git a/GitHub.Authentication/Assets/TextBlocks.xaml b/GitHub.Authentication/Assets/TextBlocks.xaml index dae601f..6f6f1f8 100644 --- a/GitHub.Authentication/Assets/TextBlocks.xaml +++ b/GitHub.Authentication/Assets/TextBlocks.xaml @@ -1,8 +1,8 @@ - diff --git a/GitHub.Authentication/Authentication.cs b/GitHub.Authentication/Authentication.cs index 6194838..6c4dadd 100644 --- a/GitHub.Authentication/Authentication.cs +++ b/GitHub.Authentication/Authentication.cs @@ -33,7 +33,7 @@ namespace GitHub.Authentication /// /// Facilitates GitHub simple and two-factor authentication /// - public class Authentication: BaseAuthentication, IAuthentication + public class Authentication : BaseAuthentication, IAuthentication { /// /// Creates a new authentication diff --git a/GitHub.Authentication/AuthenticationResult.cs b/GitHub.Authentication/AuthenticationResult.cs index 29cccc7..d710217 100644 --- a/GitHub.Authentication/AuthenticationResult.cs +++ b/GitHub.Authentication/AuthenticationResult.cs @@ -30,7 +30,7 @@ using Microsoft.Alm.Authentication; namespace GitHub.Authentication { [DebuggerDisplay("{Type}")] - public struct AuthenticationResult: IEquatable + public struct AuthenticationResult : IEquatable { public AuthenticationResult(GitHubAuthenticationResultType type) { diff --git a/GitHub.Authentication/Authority.cs b/GitHub.Authentication/Authority.cs index a32c6c1..56defda 100644 --- a/GitHub.Authentication/Authority.cs +++ b/GitHub.Authentication/Authority.cs @@ -35,7 +35,7 @@ using Git = Microsoft.Alm.Git; namespace GitHub.Authentication { - internal class Authority: IAuthority + internal class Authority : IAuthority { /// /// The GitHub required HTTP accepts header value diff --git a/GitHub.Authentication/Controls/Buttons/OcticonButton.cs b/GitHub.Authentication/Controls/Buttons/OcticonButton.cs index 7c08dce..b6aa06e 100644 --- a/GitHub.Authentication/Controls/Buttons/OcticonButton.cs +++ b/GitHub.Authentication/Controls/Buttons/OcticonButton.cs @@ -28,7 +28,7 @@ using System.Windows.Controls; namespace GitHub.UI { - public class OcticonButton: Button + public class OcticonButton : Button { public static readonly DependencyProperty IconRotationAngleProperty = DependencyProperty.Register( nameof(IconRotationAngle), typeof(double), typeof(OcticonButton), diff --git a/GitHub.Authentication/Controls/Buttons/OcticonCircleButton.cs b/GitHub.Authentication/Controls/Buttons/OcticonCircleButton.cs index f1f2821..37b4d14 100644 --- a/GitHub.Authentication/Controls/Buttons/OcticonCircleButton.cs +++ b/GitHub.Authentication/Controls/Buttons/OcticonCircleButton.cs @@ -29,7 +29,7 @@ using System.Windows.Shapes; namespace GitHub.UI { - public class OcticonCircleButton: OcticonButton + public class OcticonCircleButton : OcticonButton { public static readonly DependencyProperty ShowSpinnerProperty = DependencyProperty.Register( nameof(ShowSpinner), typeof(bool), typeof(OcticonCircleButton)); diff --git a/GitHub.Authentication/Controls/CredentialsControl.xaml b/GitHub.Authentication/Controls/CredentialsControl.xaml index 8030b73..bd59eae 100644 --- a/GitHub.Authentication/Controls/CredentialsControl.xaml +++ b/GitHub.Authentication/Controls/CredentialsControl.xaml @@ -1,4 +1,4 @@ - /// Interaction logic for CredentialsControl.xaml /// - public partial class CredentialsControl: DialogUserControl + public partial class CredentialsControl : DialogUserControl { public CredentialsControl() { diff --git a/GitHub.Authentication/Controls/HorizontalShadowDivider.xaml b/GitHub.Authentication/Controls/HorizontalShadowDivider.xaml index a683e07..bdffb0a 100644 --- a/GitHub.Authentication/Controls/HorizontalShadowDivider.xaml +++ b/GitHub.Authentication/Controls/HorizontalShadowDivider.xaml @@ -1,4 +1,4 @@ - - public class OcticonPath: Shape + public class OcticonPath : Shape { private static readonly Lazy>> cache = new Lazy>>(PrepareCache); diff --git a/GitHub.Authentication/Controls/Panels/FixedAspectRatioPanel.cs b/GitHub.Authentication/Controls/Panels/FixedAspectRatioPanel.cs index 41f23df..ea26762 100644 --- a/GitHub.Authentication/Controls/Panels/FixedAspectRatioPanel.cs +++ b/GitHub.Authentication/Controls/Panels/FixedAspectRatioPanel.cs @@ -31,7 +31,7 @@ using GitHub.Shared.Converters; namespace GitHub.UI { - public class FixedAspectRatioPanel: Panel + public class FixedAspectRatioPanel : Panel { public static readonly DependencyProperty AspectRatioProperty = DependencyProperty.Register( nameof(AspectRatio), typeof(double), typeof(FixedAspectRatioPanel), new FrameworkPropertyMetadata(1d) diff --git a/GitHub.Authentication/Controls/Text/ValidationMessage.cs b/GitHub.Authentication/Controls/Text/ValidationMessage.cs index 713192b..8271551 100644 --- a/GitHub.Authentication/Controls/Text/ValidationMessage.cs +++ b/GitHub.Authentication/Controls/Text/ValidationMessage.cs @@ -32,7 +32,7 @@ using GitHub.Shared.ViewModels.Validation; namespace GitHub.UI { - public class ValidationMessage: UserControl + public class ValidationMessage : UserControl { private const double defaultTextChangeThrottle = 0.2; diff --git a/GitHub.Authentication/Controls/TwoFactorControl.xaml b/GitHub.Authentication/Controls/TwoFactorControl.xaml index 5728e65..7f4a9ca 100644 --- a/GitHub.Authentication/Controls/TwoFactorControl.xaml +++ b/GitHub.Authentication/Controls/TwoFactorControl.xaml @@ -1,4 +1,4 @@ - + public class TwoFactorInputToTextBox : ValueConverterMarkupExtension { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { @@ -46,7 +46,7 @@ namespace GitHub.UI /// /// Interaction logic for TwoFactorInput.xaml /// - public partial class TwoFactorInput: UserControl + public partial class TwoFactorInput : UserControl { public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(TwoFactorInput), new PropertyMetadata("")); diff --git a/GitHub.Authentication/CredentialsWindow.xaml.cs b/GitHub.Authentication/CredentialsWindow.xaml.cs index bb4048d..e414cfa 100644 --- a/GitHub.Authentication/CredentialsWindow.xaml.cs +++ b/GitHub.Authentication/CredentialsWindow.xaml.cs @@ -31,7 +31,7 @@ namespace GitHub.Authentication /// /// Interaction logic for CredentialsWindow.xaml /// - public partial class CredentialsWindow: AuthenticationDialogWindow + public partial class CredentialsWindow : AuthenticationDialogWindow { public CredentialsWindow() { diff --git a/GitHub.Authentication/Helpers/BindingProxy.cs b/GitHub.Authentication/Helpers/BindingProxy.cs index f0b4e89..6767bab 100644 --- a/GitHub.Authentication/Helpers/BindingProxy.cs +++ b/GitHub.Authentication/Helpers/BindingProxy.cs @@ -31,7 +31,7 @@ using System.Windows; namespace GitHub.UI { // http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/ - public class BindingProxy: Freezable + public class BindingProxy : Freezable { protected override Freezable CreateInstanceCore() { diff --git a/GitHub.Authentication/IAuthentication.cs b/GitHub.Authentication/IAuthentication.cs index 820f593..82d2d0b 100644 --- a/GitHub.Authentication/IAuthentication.cs +++ b/GitHub.Authentication/IAuthentication.cs @@ -28,7 +28,7 @@ using Microsoft.Alm.Authentication; namespace GitHub.Authentication { - public interface IAuthentication: Microsoft.Alm.Authentication.IAuthentication + public interface IAuthentication : Microsoft.Alm.Authentication.IAuthentication { /// /// diff --git a/GitHub.Authentication/Tester.xaml.cs b/GitHub.Authentication/Tester.xaml.cs index 2303fb9..8a384ac 100644 --- a/GitHub.Authentication/Tester.xaml.cs +++ b/GitHub.Authentication/Tester.xaml.cs @@ -5,7 +5,7 @@ namespace GitHub.Authentication /// /// Interaction logic for Tester.xaml /// - public partial class Tester: Window + public partial class Tester : Window { public Tester() { diff --git a/GitHub.Authentication/TokenScope.cs b/GitHub.Authentication/TokenScope.cs index 9c408b8..86646b3 100644 --- a/GitHub.Authentication/TokenScope.cs +++ b/GitHub.Authentication/TokenScope.cs @@ -31,7 +31,7 @@ using ScopeSet = System.Collections.Generic.HashSet; namespace GitHub.Authentication { - public sealed class TokenScope: Microsoft.Alm.Authentication.TokenScope, IEquatable + public sealed class TokenScope : Microsoft.Alm.Authentication.TokenScope, IEquatable { public static readonly TokenScope None = new TokenScope(string.Empty); diff --git a/GitHub.Authentication/TwoFactorWindow.xaml.cs b/GitHub.Authentication/TwoFactorWindow.xaml.cs index d352bb0..83d093c 100644 --- a/GitHub.Authentication/TwoFactorWindow.xaml.cs +++ b/GitHub.Authentication/TwoFactorWindow.xaml.cs @@ -28,7 +28,7 @@ using GitHub.Shared.Controls; namespace GitHub.Authentication { - public partial class TwoFactorWindow: AuthenticationDialogWindow + public partial class TwoFactorWindow : AuthenticationDialogWindow { public TwoFactorWindow() { diff --git a/GitHub.Authentication/ViewModels/CredentialsViewModel.cs b/GitHub.Authentication/ViewModels/CredentialsViewModel.cs index f75cc81..bf42cba 100644 --- a/GitHub.Authentication/ViewModels/CredentialsViewModel.cs +++ b/GitHub.Authentication/ViewModels/CredentialsViewModel.cs @@ -31,7 +31,7 @@ using GitHub.Shared.ViewModels.Validation; namespace GitHub.Authentication.ViewModels { - public class CredentialsViewModel: DialogViewModel + public class CredentialsViewModel : DialogViewModel { public CredentialsViewModel() { diff --git a/GitHub.Authentication/ViewModels/TwoFactorViewModel.cs b/GitHub.Authentication/ViewModels/TwoFactorViewModel.cs index 7aaaa07..ddfeb37 100644 --- a/GitHub.Authentication/ViewModels/TwoFactorViewModel.cs +++ b/GitHub.Authentication/ViewModels/TwoFactorViewModel.cs @@ -33,7 +33,7 @@ namespace GitHub.Authentication.ViewModels /// /// Simple view model for the GitHub Two Factor dialog. /// - public class TwoFactorViewModel: DialogViewModel + public class TwoFactorViewModel : DialogViewModel { /// /// This is used by the GitHub.Authentication test application diff --git a/GitHub.Authentication/packages.config b/GitHub.Authentication/packages.config index 1a26b3d..b465822 100644 --- a/GitHub.Authentication/packages.config +++ b/GitHub.Authentication/packages.config @@ -1,4 +1,4 @@  - \ No newline at end of file + diff --git a/Gui-Shared/Controls/AuthenticationDialogWindow.cs b/Gui-Shared/Controls/AuthenticationDialogWindow.cs index 324dfc0..eb02d26 100644 --- a/Gui-Shared/Controls/AuthenticationDialogWindow.cs +++ b/Gui-Shared/Controls/AuthenticationDialogWindow.cs @@ -29,7 +29,7 @@ using GitHub.Shared.ViewModels; namespace GitHub.Shared.Controls { - public abstract class AuthenticationDialogWindow: Window + public abstract class AuthenticationDialogWindow : Window { protected AuthenticationDialogWindow() { diff --git a/Gui-Shared/Controls/DialogUserControl.cs b/Gui-Shared/Controls/DialogUserControl.cs index cae2e0c..3b8214a 100644 --- a/Gui-Shared/Controls/DialogUserControl.cs +++ b/Gui-Shared/Controls/DialogUserControl.cs @@ -29,7 +29,7 @@ using System.Windows.Threading; namespace GitHub.Shared.Controls { - public abstract class DialogUserControl: UserControl + public abstract class DialogUserControl : UserControl { protected DialogUserControl() { diff --git a/Gui-Shared/Controls/MaskedPasswordBox.cs b/Gui-Shared/Controls/MaskedPasswordBox.cs index 8be2be3..a201675 100644 --- a/Gui-Shared/Controls/MaskedPasswordBox.cs +++ b/Gui-Shared/Controls/MaskedPasswordBox.cs @@ -41,7 +41,7 @@ namespace GitHub.Shared.Controls /// make a difference. /// /// - public class MaskedPasswordBox: PromptTextBox + public class MaskedPasswordBox : PromptTextBox { // Fake char to display in Visual Tree private const char pwdChar = '●'; diff --git a/Gui-Shared/Controls/PromptTextBox.cs b/Gui-Shared/Controls/PromptTextBox.cs index 3f39a32..93a2713 100644 --- a/Gui-Shared/Controls/PromptTextBox.cs +++ b/Gui-Shared/Controls/PromptTextBox.cs @@ -29,7 +29,7 @@ using System.Windows.Controls; namespace GitHub.Shared.Controls { - public class PromptTextBox: TextBox + public class PromptTextBox : TextBox { public static readonly DependencyProperty PromptTextProperty = DependencyProperty.Register(nameof(PromptText), typeof(string), typeof(PromptTextBox), new UIPropertyMetadata("")); diff --git a/Gui-Shared/Converters/AspectRatioConverter.cs b/Gui-Shared/Converters/AspectRatioConverter.cs index fe5031a..d40b362 100644 --- a/Gui-Shared/Converters/AspectRatioConverter.cs +++ b/Gui-Shared/Converters/AspectRatioConverter.cs @@ -29,7 +29,7 @@ using System.Linq; namespace GitHub.Shared.Converters { - public class AspectRatioConverter: DoubleConverter + public class AspectRatioConverter : DoubleConverter { public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { diff --git a/Gui-Shared/Converters/BooleanToHiddenVisibilityConverter.cs b/Gui-Shared/Converters/BooleanToHiddenVisibilityConverter.cs index 97e2244..fea4a06 100644 --- a/Gui-Shared/Converters/BooleanToHiddenVisibilityConverter.cs +++ b/Gui-Shared/Converters/BooleanToHiddenVisibilityConverter.cs @@ -30,7 +30,7 @@ using System.Windows; namespace GitHub.Shared.Converters { [Localizability(LocalizationCategory.NeverLocalize)] - public sealed class BooleanToHiddenVisibilityConverter: ValueConverterMarkupExtension + public sealed class BooleanToHiddenVisibilityConverter : ValueConverterMarkupExtension { public override object Convert( object value, diff --git a/Gui-Shared/Converters/BooleanToInverseHiddenVisibilityConverter.cs b/Gui-Shared/Converters/BooleanToInverseHiddenVisibilityConverter.cs index c484e5f..e447f02 100644 --- a/Gui-Shared/Converters/BooleanToInverseHiddenVisibilityConverter.cs +++ b/Gui-Shared/Converters/BooleanToInverseHiddenVisibilityConverter.cs @@ -30,7 +30,7 @@ using System.Windows; namespace GitHub.Shared.Converters { [Localizability(LocalizationCategory.NeverLocalize)] - public sealed class BooleanToInverseHiddenVisibilityConverter: ValueConverterMarkupExtension + public sealed class BooleanToInverseHiddenVisibilityConverter : ValueConverterMarkupExtension { public override object Convert(object value, Type targetType, diff --git a/Gui-Shared/Converters/BooleanToVisibilityConverter.cs b/Gui-Shared/Converters/BooleanToVisibilityConverter.cs index 2b54fff..a5fb13e 100644 --- a/Gui-Shared/Converters/BooleanToVisibilityConverter.cs +++ b/Gui-Shared/Converters/BooleanToVisibilityConverter.cs @@ -30,7 +30,7 @@ using System.Windows; namespace GitHub.Shared.Converters { [Localizability(LocalizationCategory.NeverLocalize)] - public sealed class BooleanToVisibilityConverter: ValueConverterMarkupExtension + public sealed class BooleanToVisibilityConverter : ValueConverterMarkupExtension { private readonly System.Windows.Controls.BooleanToVisibilityConverter converter = new System.Windows.Controls.BooleanToVisibilityConverter(); diff --git a/Gui-Shared/Converters/ThicknessConverter.cs b/Gui-Shared/Converters/ThicknessConverter.cs index cc68800..c25ae9c 100644 --- a/Gui-Shared/Converters/ThicknessConverter.cs +++ b/Gui-Shared/Converters/ThicknessConverter.cs @@ -29,7 +29,7 @@ using System.Windows.Data; namespace GitHub.Shared.Converters { - public class ThicknessConverter: IValueConverter + public class ThicknessConverter : IValueConverter { public object Convert( object value, diff --git a/Gui-Shared/Converters/ValueConverterMarkupExtension.cs b/Gui-Shared/Converters/ValueConverterMarkupExtension.cs index 57c13dd..1400f57 100644 --- a/Gui-Shared/Converters/ValueConverterMarkupExtension.cs +++ b/Gui-Shared/Converters/ValueConverterMarkupExtension.cs @@ -43,7 +43,7 @@ namespace GitHub.Shared.Converters /// looking at theirs because I know mine will be better. ;) /// /// - public abstract class ValueConverterMarkupExtension: MarkupExtension, IValueConverter where T : class, IValueConverter, new() + public abstract class ValueConverterMarkupExtension : MarkupExtension, IValueConverter where T : class, IValueConverter, new() { private static T converter; diff --git a/Gui-Shared/Helpers/ActionCommand.cs b/Gui-Shared/Helpers/ActionCommand.cs index 2339237..d921272 100644 --- a/Gui-Shared/Helpers/ActionCommand.cs +++ b/Gui-Shared/Helpers/ActionCommand.cs @@ -31,7 +31,7 @@ namespace GitHub.Shared.Helpers /// /// Command that performs the specified action when invoked. /// - public class ActionCommand: ICommand + public class ActionCommand : ICommand { private Action _commandAction; diff --git a/Gui-Shared/Helpers/HyperLinkCommand.cs b/Gui-Shared/Helpers/HyperLinkCommand.cs index 6449d06..619dee8 100644 --- a/Gui-Shared/Helpers/HyperLinkCommand.cs +++ b/Gui-Shared/Helpers/HyperLinkCommand.cs @@ -31,7 +31,7 @@ namespace GitHub.Shared.Helpers /// /// Command that opens a browser to the URL specified by the command parameter. /// - public class HyperLinkCommand: ActionCommand + public class HyperLinkCommand : ActionCommand { public HyperLinkCommand() : base(ExecuteNavigateUrl) { diff --git a/Gui-Shared/ViewModels/DialogViewModel.cs b/Gui-Shared/ViewModels/DialogViewModel.cs index 0a519df..09cad21 100644 --- a/Gui-Shared/ViewModels/DialogViewModel.cs +++ b/Gui-Shared/ViewModels/DialogViewModel.cs @@ -25,7 +25,7 @@ namespace GitHub.Shared.ViewModels { - public class DialogViewModel: ViewModel + public class DialogViewModel : ViewModel { private AuthenticationDialogResult _result = AuthenticationDialogResult.None; diff --git a/Gui-Shared/ViewModels/Validation/ModelValidator.cs b/Gui-Shared/ViewModels/Validation/ModelValidator.cs index 9de1a15..98e4dd5 100644 --- a/Gui-Shared/ViewModels/Validation/ModelValidator.cs +++ b/Gui-Shared/ViewModels/Validation/ModelValidator.cs @@ -32,7 +32,7 @@ namespace GitHub.Shared.ViewModels.Validation /// A validator that represents the validation state of a model. It's true if all the supplied /// property validators are true. /// - public class ModelValidator: ViewModel + public class ModelValidator : ViewModel { public ModelValidator(params PropertyValidator[] propertyValidators) { @@ -54,6 +54,7 @@ namespace GitHub.Shared.ViewModels.Validation } private bool _isValid; + public bool IsValid { get { return _isValid; } diff --git a/Gui-Shared/ViewModels/Validation/PropertyValidator.cs b/Gui-Shared/ViewModels/Validation/PropertyValidator.cs index 5138e83..60e414b 100644 --- a/Gui-Shared/ViewModels/Validation/PropertyValidator.cs +++ b/Gui-Shared/ViewModels/Validation/PropertyValidator.cs @@ -31,7 +31,7 @@ using System.Reflection; namespace GitHub.Shared.ViewModels.Validation { - public abstract class PropertyValidator: ViewModel + public abstract class PropertyValidator : ViewModel { /// /// Creates a validator for a property. This validator is the starting point to attach other @@ -67,7 +67,7 @@ namespace GitHub.Shared.ViewModels.Validation } } - public class PropertyValidator: PropertyValidator + public class PropertyValidator : PropertyValidator { // This should only be used by PropertyValidator protected PropertyValidator() { } @@ -120,7 +120,7 @@ namespace GitHub.Shared.ViewModels.Validation /// /// /// - public class PropertyValidator: PropertyValidator where TObject : INotifyPropertyChanged + public class PropertyValidator : PropertyValidator where TObject : INotifyPropertyChanged { internal PropertyValidator(TObject source, Expression> propertyExpression) { diff --git a/Gui-Shared/ViewModels/ViewModel.cs b/Gui-Shared/ViewModels/ViewModel.cs index 3609c7f..a149326 100644 --- a/Gui-Shared/ViewModels/ViewModel.cs +++ b/Gui-Shared/ViewModels/ViewModel.cs @@ -31,7 +31,7 @@ namespace GitHub.Shared.ViewModels /// Rather than bring in all the overhead of an MVVM framework, we'll just do the simplest /// possible thing. /// - public class ViewModel: INotifyPropertyChanged + public class ViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; diff --git a/Microsoft.Alm.Authentication.Test/TargetUriTests.cs b/Microsoft.Alm.Authentication.Test/TargetUriTests.cs index ea2e819..f799de8 100644 --- a/Microsoft.Alm.Authentication.Test/TargetUriTests.cs +++ b/Microsoft.Alm.Authentication.Test/TargetUriTests.cs @@ -54,8 +54,7 @@ namespace Microsoft.Alm.Authentication.Test targetUri = new TargetUri(actualUrl, queryUrl, proxyUrl); Assert.NotNull(targetUri); - // Since the actual Uri will substitute for a null query Uri, - // test the correct value. + // Since the actual Uri will substitute for a null query Uri, test the correct value. var uri = queryUri ?? actualUri; Assert.Equal(uri.AbsolutePath, targetUri.AbsolutePath); diff --git a/Microsoft.Alm.Authentication.Test/app.config b/Microsoft.Alm.Authentication.Test/app.config index 6d40e7c..4aa60f2 100644 --- a/Microsoft.Alm.Authentication.Test/app.config +++ b/Microsoft.Alm.Authentication.Test/app.config @@ -3,16 +3,16 @@ - - + + - - + + - + diff --git a/Microsoft.Alm.Authentication.Test/packages.config b/Microsoft.Alm.Authentication.Test/packages.config index 92e390a..de3c2ec 100644 --- a/Microsoft.Alm.Authentication.Test/packages.config +++ b/Microsoft.Alm.Authentication.Test/packages.config @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/Microsoft.Alm.Authentication/BaseAuthentication.cs b/Microsoft.Alm.Authentication/BaseAuthentication.cs index 3ae27c1..29d78c7 100644 --- a/Microsoft.Alm.Authentication/BaseAuthentication.cs +++ b/Microsoft.Alm.Authentication/BaseAuthentication.cs @@ -28,7 +28,7 @@ namespace Microsoft.Alm.Authentication /// /// Base authentication mechanisms for setting, retrieving, and deleting stored credentials. /// - public abstract class BaseAuthentication: IAuthentication + public abstract class BaseAuthentication : IAuthentication { /// /// Deletes a from the storage used by the authentication object. diff --git a/Microsoft.Alm.Authentication/BasicAuthentication.cs b/Microsoft.Alm.Authentication/BasicAuthentication.cs index a08bd99..88d3719 100644 --- a/Microsoft.Alm.Authentication/BasicAuthentication.cs +++ b/Microsoft.Alm.Authentication/BasicAuthentication.cs @@ -33,7 +33,7 @@ namespace Microsoft.Alm.Authentication /// /// Facilitates basic authentication using simple username and password schemes. /// - public sealed class BasicAuthentication: BaseAuthentication, IAuthentication + public sealed class BasicAuthentication : BaseAuthentication, IAuthentication { public static readonly Credential NtlmCredentials = WwwAuthenticateHelper.Credentials; diff --git a/Microsoft.Alm.Authentication/Credential.cs b/Microsoft.Alm.Authentication/Credential.cs index bcf448a..4a50431 100644 --- a/Microsoft.Alm.Authentication/Credential.cs +++ b/Microsoft.Alm.Authentication/Credential.cs @@ -30,7 +30,7 @@ namespace Microsoft.Alm.Authentication /// /// Credentials for user authentication. /// - public sealed class Credential: Secret, IEquatable + public sealed class Credential : Secret, IEquatable { public static readonly Credential Empty = new Credential(string.Empty, string.Empty); diff --git a/Microsoft.Alm.Authentication/NativeMethods.cs b/Microsoft.Alm.Authentication/NativeMethods.cs index 82527ba..a701493 100644 --- a/Microsoft.Alm.Authentication/NativeMethods.cs +++ b/Microsoft.Alm.Authentication/NativeMethods.cs @@ -159,14 +159,14 @@ namespace Microsoft.Alm.Authentication [Out] out IntPtr credenitalsArrayPtr); [Flags] - internal enum CredentialEnumerateFlags: uint + internal enum CredentialEnumerateFlags : uint { None = 0, AllCredentials = 1 << 0, } [Flags] - internal enum CredentialFlags: uint + internal enum CredentialFlags : uint { /// /// @@ -219,7 +219,7 @@ namespace Microsoft.Alm.Authentication UsernameTarget = 0x04, } - internal enum CredentialPersist: uint + internal enum CredentialPersist : uint { /// /// The ` ` persists for the life of the logon session. @@ -261,7 +261,7 @@ namespace Microsoft.Alm.Authentication Enterprise = 0x03 } - internal enum CredentialType: uint + internal enum CredentialType : uint { /// The `` is a generic credential. The /// credential will not be used by any particular authentication package. diff --git a/Microsoft.Alm.Authentication/Secret.cs b/Microsoft.Alm.Authentication/Secret.cs index 82305d4..86b7431 100644 --- a/Microsoft.Alm.Authentication/Secret.cs +++ b/Microsoft.Alm.Authentication/Secret.cs @@ -56,8 +56,7 @@ namespace Microsoft.Alm.Authentication } /// - /// Generate a key based on the ActualUri. - /// This may include username, port, etc + /// Generate a key based on the ActualUri. This may include username, port, etc /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1055:UriReturnValuesShouldNotBeStrings")] public static string UriToActualUrl(TargetUri targetUri, string @namespace) diff --git a/Microsoft.Alm.Authentication/SecretCache.cs b/Microsoft.Alm.Authentication/SecretCache.cs index 1edb07c..80f021b 100644 --- a/Microsoft.Alm.Authentication/SecretCache.cs +++ b/Microsoft.Alm.Authentication/SecretCache.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; namespace Microsoft.Alm.Authentication { - public sealed class SecretCache: ICredentialStore, ITokenStore + public sealed class SecretCache : ICredentialStore, ITokenStore { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly StringComparer KeyComparer = StringComparer.OrdinalIgnoreCase; diff --git a/Microsoft.Alm.Authentication/SecretStore.cs b/Microsoft.Alm.Authentication/SecretStore.cs index 353d642..c2b2edf 100644 --- a/Microsoft.Alm.Authentication/SecretStore.cs +++ b/Microsoft.Alm.Authentication/SecretStore.cs @@ -31,7 +31,7 @@ namespace Microsoft.Alm.Authentication /// Interface to secure secrets storage which indexes values by target and utilizes the operating /// system keychain / secrets vault. /// - public sealed class SecretStore: BaseSecureStore, ICredentialStore, ITokenStore + public sealed class SecretStore : BaseSecureStore, ICredentialStore, ITokenStore { /// /// Creates a new backed by the operating system keychain / secrets vault. diff --git a/Microsoft.Alm.Authentication/TargetUri.cs b/Microsoft.Alm.Authentication/TargetUri.cs index 22ba0af..bf812d2 100644 --- a/Microsoft.Alm.Authentication/TargetUri.cs +++ b/Microsoft.Alm.Authentication/TargetUri.cs @@ -310,10 +310,10 @@ namespace Microsoft.Alm.Authentication } /// - /// Get a version of this that contains the specified username. + /// Get a version of this that contains the specified username. /// /// - /// If the already contains a username, that one is kept NOT overwritten. + /// If the already contains a username, that one is kept NOT overwritten. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings")] public TargetUri GetPerUserTargetUri(string username) @@ -329,7 +329,7 @@ namespace Microsoft.Alm.Authentication } /// - /// Get a version of this that does NOT contain any username. + /// Get a version of this that does NOT contain any username. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings")] @@ -346,14 +346,14 @@ namespace Microsoft.Alm.Authentication } /// - /// Determine if the ActualUri of this contains UserInfo + /// Determine if the ActualUri of this contains UserInfo /// - public bool TargetUriContainsUsername{ get { return ActualUri.AbsoluteUri.Contains("@"); }} + public bool TargetUriContainsUsername { get { return ActualUri.AbsoluteUri.Contains("@"); } } /// - /// Get username contained in the ActualUri of this + /// Get username contained in the ActualUri of this /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] - public string TargetUriUsername { get { return ActualUri.UserInfo; } } + public string TargetUriUsername { get { return ActualUri.UserInfo; } } } } diff --git a/Microsoft.Alm.Authentication/Token.cs b/Microsoft.Alm.Authentication/Token.cs index f141b63..98f7ea7 100644 --- a/Microsoft.Alm.Authentication/Token.cs +++ b/Microsoft.Alm.Authentication/Token.cs @@ -33,7 +33,7 @@ namespace Microsoft.Alm.Authentication /// /// A security token, usually acquired by some authentication and identity services. /// - public class Token: Secret, IEquatable + public class Token : Secret, IEquatable { public static readonly StringComparer TokenComparer = StringComparer.Ordinal; diff --git a/Microsoft.Alm.Authentication/TokenScope.cs b/Microsoft.Alm.Authentication/TokenScope.cs index c036828..fca5a3f 100644 --- a/Microsoft.Alm.Authentication/TokenScope.cs +++ b/Microsoft.Alm.Authentication/TokenScope.cs @@ -30,7 +30,7 @@ using ScopeSet = System.Collections.Generic.HashSet; namespace Microsoft.Alm.Authentication { - public abstract class TokenScope: IEquatable + public abstract class TokenScope : IEquatable { protected TokenScope(string value) { diff --git a/Microsoft.Alm.Authentication/packages.config b/Microsoft.Alm.Authentication/packages.config index 1a26b3d..b465822 100644 --- a/Microsoft.Alm.Authentication/packages.config +++ b/Microsoft.Alm.Authentication/packages.config @@ -1,4 +1,4 @@  - \ No newline at end of file + diff --git a/Microsoft.Alm.Git.Test/ConfigurationTests.cs b/Microsoft.Alm.Git.Test/ConfigurationTests.cs index b445c39..b977b51 100644 --- a/Microsoft.Alm.Git.Test/ConfigurationTests.cs +++ b/Microsoft.Alm.Git.Test/ConfigurationTests.cs @@ -32,7 +32,6 @@ namespace Microsoft.Alm.Git.Test Assert.Equal(expected, values[expectedName], ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal); } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")] [Fact] public void GitConfig_ParseSampleFile() diff --git a/Microsoft.Alm.Git.Test/packages.config b/Microsoft.Alm.Git.Test/packages.config index 92e390a..de3c2ec 100644 --- a/Microsoft.Alm.Git.Test/packages.config +++ b/Microsoft.Alm.Git.Test/packages.config @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/Microsoft.Alm.Git/Configuration.cs b/Microsoft.Alm.Git/Configuration.cs index c8fa24c..c45caee 100644 --- a/Microsoft.Alm.Git/Configuration.cs +++ b/Microsoft.Alm.Git/Configuration.cs @@ -217,7 +217,7 @@ namespace Microsoft.Alm.Git } } - internal sealed class Impl: Configuration + internal sealed class Impl : Configuration { internal Impl() { } @@ -424,7 +424,7 @@ namespace Microsoft.Alm.Git } } - public struct Entry: IEquatable + public struct Entry : IEquatable { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly StringComparer KeyComparer = StringComparer.OrdinalIgnoreCase; diff --git a/Microsoft.Alm.Git/GitInstallation.cs b/Microsoft.Alm.Git/GitInstallation.cs index 1f60b31..6260410 100644 --- a/Microsoft.Alm.Git/GitInstallation.cs +++ b/Microsoft.Alm.Git/GitInstallation.cs @@ -30,7 +30,7 @@ using System.IO; namespace Microsoft.Alm.Git { - public struct GitInstallation: IEquatable + public struct GitInstallation : IEquatable { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly StringComparer PathComparer = StringComparer.InvariantCultureIgnoreCase; diff --git a/Microsoft.Alm.Git/Trace.cs b/Microsoft.Alm.Git/Trace.cs index 080586b..235b0e4 100644 --- a/Microsoft.Alm.Git/Trace.cs +++ b/Microsoft.Alm.Git/Trace.cs @@ -39,7 +39,7 @@ namespace Microsoft.Alm.Git void WriteLine(string message, string filePath, int lineNumber, string memberName); } - public sealed class Trace: ITrace, IDisposable + public sealed class Trace : ITrace, IDisposable { public const string EnvironmentVariableKey = "GCM_TRACE"; diff --git a/Microsoft.Alm.Git/Where.cs b/Microsoft.Alm.Git/Where.cs index 381e394..0ff3acf 100644 --- a/Microsoft.Alm.Git/Where.cs +++ b/Microsoft.Alm.Git/Where.cs @@ -51,7 +51,8 @@ namespace Microsoft.Alm.Git if (string.IsNullOrEmpty(pathext) || string.IsNullOrEmpty(envpath)) { - // The user is likely hosed, or a poorly crafted test case - eitherway avoid NRE from the .Split call. + // The user is likely hosed, or a poorly crafted test case - eitherway avoid NRE + // from the .Split call. path = null; return false; } diff --git a/Microsoft.Alm.Git/packages.config b/Microsoft.Alm.Git/packages.config index 1a26b3d..b465822 100644 --- a/Microsoft.Alm.Git/packages.config +++ b/Microsoft.Alm.Git/packages.config @@ -1,4 +1,4 @@  - \ No newline at end of file + diff --git a/Microsoft.Vsts.Authentication.Test/AuthorityFake.cs b/Microsoft.Vsts.Authentication.Test/AuthorityFake.cs index 8d32f1d..57b2f9d 100644 --- a/Microsoft.Vsts.Authentication.Test/AuthorityFake.cs +++ b/Microsoft.Vsts.Authentication.Test/AuthorityFake.cs @@ -4,7 +4,7 @@ using Xunit; namespace Microsoft.Alm.Authentication.Test { - internal class AuthorityFake: IVstsAuthority + internal class AuthorityFake : IVstsAuthority { public AuthorityFake(string expectedQueryParameters) { diff --git a/Microsoft.Vsts.Authentication.Test/VstsAadTests.cs b/Microsoft.Vsts.Authentication.Test/VstsAadTests.cs index f66ff89..1ea52b7 100644 --- a/Microsoft.Vsts.Authentication.Test/VstsAadTests.cs +++ b/Microsoft.Vsts.Authentication.Test/VstsAadTests.cs @@ -3,7 +3,7 @@ using Xunit; namespace Microsoft.Alm.Authentication.Test { - public class VstsAadTests: AuthenticationTests + public class VstsAadTests : AuthenticationTests { public VstsAadTests() : base() diff --git a/Microsoft.Vsts.Authentication.Test/VstsMsaTests.cs b/Microsoft.Vsts.Authentication.Test/VstsMsaTests.cs index 7491038..454f177 100644 --- a/Microsoft.Vsts.Authentication.Test/VstsMsaTests.cs +++ b/Microsoft.Vsts.Authentication.Test/VstsMsaTests.cs @@ -3,7 +3,7 @@ using Xunit; namespace Microsoft.Alm.Authentication.Test { - public class VstsMsaTests: AuthenticationTests + public class VstsMsaTests : AuthenticationTests { public VstsMsaTests() : base() diff --git a/Microsoft.Vsts.Authentication.Test/packages.config b/Microsoft.Vsts.Authentication.Test/packages.config index 92e390a..de3c2ec 100644 --- a/Microsoft.Vsts.Authentication.Test/packages.config +++ b/Microsoft.Vsts.Authentication.Test/packages.config @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/Microsoft.Vsts.Authentication/AzureAuthority.cs b/Microsoft.Vsts.Authentication/AzureAuthority.cs index 20e7edd..4620077 100644 --- a/Microsoft.Vsts.Authentication/AzureAuthority.cs +++ b/Microsoft.Vsts.Authentication/AzureAuthority.cs @@ -32,7 +32,7 @@ namespace Microsoft.Alm.Authentication /// /// Interfaces with Azure to perform authentication and identity services. /// - internal class AzureAuthority: IAzureAuthority + internal class AzureAuthority : IAzureAuthority { /// /// The base URL for logon services in Azure. diff --git a/Microsoft.Vsts.Authentication/BaseVstsAuthentication.cs b/Microsoft.Vsts.Authentication/BaseVstsAuthentication.cs index d45159d..23078e1 100644 --- a/Microsoft.Vsts.Authentication/BaseVstsAuthentication.cs +++ b/Microsoft.Vsts.Authentication/BaseVstsAuthentication.cs @@ -292,9 +292,7 @@ namespace Microsoft.Alm.Authentication /// /// Azure Directory access token with privileges to grant access to the target resource. /// - /// - /// Set of options related to generation of personal access tokens. - /// + /// Set of options related to generation of personal access tokens. /// if successful; otherwise. protected async Task GeneratePersonalAccessToken( TargetUri targetUri, diff --git a/Microsoft.Vsts.Authentication/IVstsAadAuthentication.cs b/Microsoft.Vsts.Authentication/IVstsAadAuthentication.cs index ca4a160..dd51296 100644 --- a/Microsoft.Vsts.Authentication/IVstsAadAuthentication.cs +++ b/Microsoft.Vsts.Authentication/IVstsAadAuthentication.cs @@ -40,8 +40,7 @@ namespace Microsoft.Alm.Authentication /// /// The unique identifier for the resource for which access is to be acquired. /// - /// - /// + /// /// /// A for packing into a basic authentication header; otherwise . /// @@ -84,8 +83,7 @@ namespace Microsoft.Alm.Authentication /// /// The unique identifier for the resource for which access is to be acquired. /// - /// - /// + /// /// /// A for packing into a basic authentication header; otherwise . /// diff --git a/Microsoft.Vsts.Authentication/IVstsAuthority.cs b/Microsoft.Vsts.Authentication/IVstsAuthority.cs index ffb0195..55d7e83 100644 --- a/Microsoft.Vsts.Authentication/IVstsAuthority.cs +++ b/Microsoft.Vsts.Authentication/IVstsAuthority.cs @@ -28,7 +28,7 @@ using System.Threading.Tasks; namespace Microsoft.Alm.Authentication { - internal interface IVstsAuthority: IAzureAuthority + internal interface IVstsAuthority : IAzureAuthority { Task GeneratePersonalAccessToken(TargetUri targetUri, Token accessToken, VstsTokenScope tokenScope, bool requireCompactToken, TimeSpan? tokenDuration = null); diff --git a/Microsoft.Vsts.Authentication/IVstsMsaAuthentication.cs b/Microsoft.Vsts.Authentication/IVstsMsaAuthentication.cs index 167a50f..4a4f73e 100644 --- a/Microsoft.Vsts.Authentication/IVstsMsaAuthentication.cs +++ b/Microsoft.Vsts.Authentication/IVstsMsaAuthentication.cs @@ -40,8 +40,7 @@ namespace Microsoft.Alm.Authentication /// /// The unique identifier for the resource for which access is to be acquired. /// - /// - /// + /// /// /// A for packing into a basic authentication header; otherwise . /// diff --git a/Microsoft.Vsts.Authentication/PersonalAccessTokenOptions.cs b/Microsoft.Vsts.Authentication/PersonalAccessTokenOptions.cs index 958cfac..f37b90e 100644 --- a/Microsoft.Vsts.Authentication/PersonalAccessTokenOptions.cs +++ b/Microsoft.Vsts.Authentication/PersonalAccessTokenOptions.cs @@ -61,11 +61,10 @@ namespace Microsoft.Alm.Authentication /// /// - /// Requests a limited duration personal access token when specified; otherwise the default duration is requested. - /// - /// - /// Cannot be less than one hour; values less than one hour (1hr) are ignored. + /// Requests a limited duration personal access token when specified; otherwise the default + /// duration is requested. /// + /// Cannot be less than one hour; values less than one hour (1hr) are ignored. /// public TimeSpan? TokenDuration { diff --git a/Microsoft.Vsts.Authentication/TokenRegistry.cs b/Microsoft.Vsts.Authentication/TokenRegistry.cs index 60b00f8..75db5fb 100644 --- a/Microsoft.Vsts.Authentication/TokenRegistry.cs +++ b/Microsoft.Vsts.Authentication/TokenRegistry.cs @@ -35,7 +35,7 @@ namespace Microsoft.Alm.Authentication /// A token storage object which interacts with the current user's Visual Studio 2015 hive in the /// Windows Registry. /// - public sealed class TokenRegistry: ITokenStore + public sealed class TokenRegistry : ITokenStore { private const string RegistryTokenKey = "Token"; private const string RegistryTypeKey = "Type"; diff --git a/Microsoft.Vsts.Authentication/VstsAadAuthentication.cs b/Microsoft.Vsts.Authentication/VstsAadAuthentication.cs index 229f6ec..12d3112 100644 --- a/Microsoft.Vsts.Authentication/VstsAadAuthentication.cs +++ b/Microsoft.Vsts.Authentication/VstsAadAuthentication.cs @@ -32,7 +32,7 @@ namespace Microsoft.Alm.Authentication /// /// Facilitates Azure Directory authentication. /// - public sealed class VstsAadAuthentication: BaseVstsAuthentication, IVstsAadAuthentication + public sealed class VstsAadAuthentication : BaseVstsAuthentication, IVstsAadAuthentication { /// /// diff --git a/Microsoft.Vsts.Authentication/VstsAdalTokenCache.cs b/Microsoft.Vsts.Authentication/VstsAdalTokenCache.cs index 1581851..b6ac1a3 100644 --- a/Microsoft.Vsts.Authentication/VstsAdalTokenCache.cs +++ b/Microsoft.Vsts.Authentication/VstsAdalTokenCache.cs @@ -31,7 +31,7 @@ using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Alm.Authentication { - internal class VstsAdalTokenCache: IdentityModel.Clients.ActiveDirectory.TokenCache + internal class VstsAdalTokenCache : IdentityModel.Clients.ActiveDirectory.TokenCache { private readonly IReadOnlyList> AdalCachePaths = new string[][] { diff --git a/Microsoft.Vsts.Authentication/VstsAzureAuthority.cs b/Microsoft.Vsts.Authentication/VstsAzureAuthority.cs index 38bccc5..7ef3eb8 100644 --- a/Microsoft.Vsts.Authentication/VstsAzureAuthority.cs +++ b/Microsoft.Vsts.Authentication/VstsAzureAuthority.cs @@ -35,7 +35,7 @@ using System.Threading.Tasks; namespace Microsoft.Alm.Authentication { - internal class VstsAzureAuthority: AzureAuthority, IVstsAuthority + internal class VstsAzureAuthority : AzureAuthority, IVstsAuthority { public VstsAzureAuthority(string authorityHostUrl = null) : base() diff --git a/Microsoft.Vsts.Authentication/VstsLocationServiceException.cs b/Microsoft.Vsts.Authentication/VstsLocationServiceException.cs index 1941110..15a5e21 100644 --- a/Microsoft.Vsts.Authentication/VstsLocationServiceException.cs +++ b/Microsoft.Vsts.Authentication/VstsLocationServiceException.cs @@ -28,7 +28,7 @@ using System; namespace Microsoft.Alm.Authentication { [Serializable] - public sealed class VstsLocationServiceException: Exception, System.Runtime.Serialization.ISerializable + public sealed class VstsLocationServiceException : Exception, System.Runtime.Serialization.ISerializable { internal VstsLocationServiceException(string message) : base(message) diff --git a/Microsoft.Vsts.Authentication/VstsMsaAuthentication.cs b/Microsoft.Vsts.Authentication/VstsMsaAuthentication.cs index 266a672..2e47c87 100644 --- a/Microsoft.Vsts.Authentication/VstsMsaAuthentication.cs +++ b/Microsoft.Vsts.Authentication/VstsMsaAuthentication.cs @@ -30,7 +30,7 @@ using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Alm.Authentication { - public sealed class VstsMsaAuthentication: BaseVstsAuthentication, IVstsMsaAuthentication + public sealed class VstsMsaAuthentication : BaseVstsAuthentication, IVstsMsaAuthentication { public const string DefaultAuthorityHost = AzureAuthority.AuthorityHostUrlBase + "/live.com"; internal const string QueryParameters = "domain_hint=live.com&display=popup&site_id=501454&nux=1"; @@ -64,8 +64,7 @@ namespace Microsoft.Alm.Authentication /// /// The uniform resource indicator of the resource access tokens are being requested for. /// - /// - /// + /// /// /// A for packing into a basic authentication header; otherwise . /// diff --git a/Microsoft.Vsts.Authentication/VstsTokenScope.cs b/Microsoft.Vsts.Authentication/VstsTokenScope.cs index 8f79834..743caa0 100644 --- a/Microsoft.Vsts.Authentication/VstsTokenScope.cs +++ b/Microsoft.Vsts.Authentication/VstsTokenScope.cs @@ -23,14 +23,13 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." **/ -using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using ScopeSet = System.Collections.Generic.HashSet; namespace Microsoft.Alm.Authentication { - public class VstsTokenScope: TokenScope + public class VstsTokenScope : TokenScope { public static readonly VstsTokenScope None = new VstsTokenScope(string.Empty); diff --git a/Microsoft.Vsts.Authentication/packages.config b/Microsoft.Vsts.Authentication/packages.config index a3d7093..d86984f 100644 --- a/Microsoft.Vsts.Authentication/packages.config +++ b/Microsoft.Vsts.Authentication/packages.config @@ -3,4 +3,4 @@ - \ No newline at end of file + diff --git a/xunit.runner.json b/xunit.runner.json index de765d3..0021acb 100644 --- a/xunit.runner.json +++ b/xunit.runner.json @@ -6,4 +6,4 @@ "parallelizeTestCollections": true, "preEnumerateTheories": true, "shadowCopy": false -} \ No newline at end of file +}