Clean up source code and licenses.
Ran CodeMaid, also corrected/added missing licenses.
This commit is contained in:
Родитель
2145692ddb
Коммит
3b75464958
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -8,4 +8,4 @@
|
|||
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net452" />
|
||||
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net452" />
|
||||
<package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net452" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -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.
|
||||
/// </summary>
|
||||
public partial class App: Application
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Atlassian.Bitbucket.Authentication
|
|||
/// <see cref="IAuthentication"/> and providing functionality to manage credentials for Bitbucket
|
||||
/// hosting service.
|
||||
/// </summary>
|
||||
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;
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Atlassian.Bitbucket.Authentication
|
|||
public string RemoteUsername { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Flag indicating if the results is a success
|
||||
/// Flag indicating if the results is a success
|
||||
/// </summary>
|
||||
public bool IsSuccess { get { return Type.Equals(AuthenticationResultType.Success); } }
|
||||
|
||||
|
|
|
@ -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 <see cref="IAuthority"/> representing the Bitbucket APIs as the authority
|
||||
/// that can provide and validate credentials for Bitbucket.
|
||||
/// </summary>
|
||||
internal class Authority: IAuthority
|
||||
internal class Authority : IAuthority
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the HTTP encoded version of the Credentials secret
|
||||
/// Get the HTTP encoded version of the Credentials secret
|
||||
/// </summary>
|
||||
private static string GetEncodedCredentials(string username, Credential credentials)
|
||||
{
|
||||
|
@ -188,7 +185,7 @@ namespace Atlassian.Bitbucket.Authentication
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the HTTP encoded version of the Credentials secret
|
||||
/// Get the HTTP encoded version of the Credentials secret
|
||||
/// </summary>
|
||||
private static string GetEncodedCredentials(string user, string password)
|
||||
{
|
||||
|
|
|
@ -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<AuthenticationResult> 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);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
**/
|
||||
-->
|
||||
<sharedControls:DialogUserControl
|
||||
<sharedControls:DialogUserControl
|
||||
x:Class="Atlassian.Bitbucket.Authentication.Controls.CredentialsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
**/
|
||||
|
||||
using System;
|
||||
using GitHub.Shared.Helpers;
|
||||
using GitHub.Shared.Controls;
|
||||
using GitHub.Shared.Helpers;
|
||||
|
||||
namespace Atlassian.Bitbucket.Authentication.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the UI used to prompt users for username/password credentials for Bitbucket accounts.
|
||||
/// </summary>
|
||||
public partial class CredentialsControl: DialogUserControl
|
||||
public partial class CredentialsControl : DialogUserControl
|
||||
{
|
||||
public CredentialsControl()
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
**/
|
||||
-->
|
||||
<UserControl
|
||||
<UserControl
|
||||
x:Class="Atlassian.Bitbucket.Authentication.Controls.HorizontalShadowDivider"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Atlassian.Bitbucket.Authentication.Controls
|
||||
{
|
||||
public partial class HorizontalShadowDivider: UserControl
|
||||
public partial class HorizontalShadowDivider : UserControl
|
||||
{
|
||||
public HorizontalShadowDivider()
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
**/
|
||||
-->
|
||||
<sharedControls:DialogUserControl
|
||||
<sharedControls:DialogUserControl
|
||||
x:Class="Atlassian.Bitbucket.Authentication.Controls.OAuthControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Atlassian.Bitbucket.Authentication.Controls
|
|||
/// <summary>
|
||||
/// Defines the UI used to prompt a user to run the OAuth authorization process.
|
||||
/// </summary>
|
||||
public partial class OAuthControl: DialogUserControl
|
||||
public partial class OAuthControl : DialogUserControl
|
||||
{
|
||||
public OAuthControl()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<string>;
|
||||
|
@ -34,7 +33,7 @@ namespace Atlassian.Bitbucket.Authentication
|
|||
/// <summary>
|
||||
/// Defines the available scopes associated with OAuth tokens in Bitbucket.
|
||||
/// </summary>
|
||||
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);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Atlassian.Bitbucket.Authentication.ViewModels
|
|||
/// <summary>
|
||||
/// The ViewModel behind the Basic Auth username/password UI prompt.
|
||||
/// </summary>
|
||||
public class CredentialsViewModel: DialogViewModel
|
||||
public class CredentialsViewModel : DialogViewModel
|
||||
{
|
||||
public CredentialsViewModel() : this(string.Empty)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Atlassian.Bitbucket.Authentication.ViewModels
|
|||
/// <summary>
|
||||
/// The ViewModel behind the OAuth UI prompt
|
||||
/// </summary>
|
||||
public class OAuthViewModel: DialogViewModel
|
||||
public class OAuthViewModel : DialogViewModel
|
||||
{
|
||||
private bool _resultType;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
**/
|
||||
-->
|
||||
<sharedControls:AuthenticationDialogWindow
|
||||
<sharedControls:AuthenticationDialogWindow
|
||||
x:Class="Atlassian.Bitbucket.Authentication.Views.CredentialsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Atlassian.Bitbucket.Authentication.Views
|
|||
/// prompted with a second UI to ask for OAuth authorisation <see cref="OAuthWindow"/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
partial class CredentialsWindow: AuthenticationDialogWindow
|
||||
partial class CredentialsWindow : AuthenticationDialogWindow
|
||||
{
|
||||
public CredentialsWindow()
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Atlassian.Bitbucket.Authentication.Views
|
|||
/// enabled on their account. Prompts the user to run the OAuth authorization process.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public partial class OAuthWindow: AuthenticationDialogWindow
|
||||
public partial class OAuthWindow : AuthenticationDialogWindow
|
||||
{
|
||||
public OAuthWindow()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Net.Compilers" version="2.2.0" targetFramework="net451" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 <username>[:<password>]@<url>
|
||||
// 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 <username>[:<password>]@<url> 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);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.Alm.Gui
|
|||
/// Interaction logic for PassphraseWindow.xaml
|
||||
/// </summary>
|
||||
[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";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Net.Compilers" version="2.2.0" targetFramework="net451" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net462" />
|
||||
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net462" />
|
||||
<package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net462" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -1037,7 +1037,7 @@ namespace Microsoft.Alm.Cli
|
|||
}
|
||||
}
|
||||
|
||||
public enum ResultValue: int
|
||||
public enum ResultValue : int
|
||||
{
|
||||
UnknownFailure = -1,
|
||||
Success = 0,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Net.Compilers" version="2.2.0" targetFramework="net451" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -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<BaseAuthentication> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Microsoft.Alm
|
|||
private const string Kernel32 = "kernel32.dll";
|
||||
|
||||
[Flags]
|
||||
public enum ConsoleMode: uint
|
||||
public enum ConsoleMode : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Creates a new file, only if it does not already exist.</para>
|
||||
|
@ -345,7 +345,7 @@ namespace Microsoft.Alm
|
|||
}
|
||||
|
||||
[Flags]
|
||||
public enum FileShare: uint
|
||||
public enum FileShare : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
{
|
||||
/// <summary> <para>The `<see cref="Credential"/>` is a generic credential. The
|
||||
/// credential will not be used by any particular authentication package.</para>
|
||||
|
@ -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,
|
||||
/// <summary>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Двоичные данные
GitHub.Authentication.Test/GlobalSuppressions.cs
Двоичные данные
GitHub.Authentication.Test/GlobalSuppressions.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")]
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
|||
}
|
||||
|
||||
/// <summary/>
|
||||
///
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
public class WpfTheoryAttribute : TheoryAttribute { }
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net452" />
|
||||
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net452" />
|
||||
<package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net452" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
|
|
|
@ -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.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public partial class App: Application
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<ResourceDictionary
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:GitHub.UI"
|
||||
xmlns:sharedControls="clr-namespace:GitHub.Shared.Controls"
|
||||
mc:Ignorable="d">
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace GitHub.Authentication
|
|||
/// <summary>
|
||||
/// Facilitates GitHub simple and two-factor authentication
|
||||
/// </summary>
|
||||
public class Authentication: BaseAuthentication, IAuthentication
|
||||
public class Authentication : BaseAuthentication, IAuthentication
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new authentication
|
||||
|
|
|
@ -30,7 +30,7 @@ using Microsoft.Alm.Authentication;
|
|||
namespace GitHub.Authentication
|
||||
{
|
||||
[DebuggerDisplay("{Type}")]
|
||||
public struct AuthenticationResult: IEquatable<AuthenticationResult>
|
||||
public struct AuthenticationResult : IEquatable<AuthenticationResult>
|
||||
{
|
||||
public AuthenticationResult(GitHubAuthenticationResultType type)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ using Git = Microsoft.Alm.Git;
|
|||
|
||||
namespace GitHub.Authentication
|
||||
{
|
||||
internal class Authority: IAuthority
|
||||
internal class Authority : IAuthority
|
||||
{
|
||||
/// <summary>
|
||||
/// The GitHub required HTTP accepts header value
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<sharedControls:DialogUserControl
|
||||
<sharedControls:DialogUserControl
|
||||
x:Class="GitHub.UI.CredentialsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace GitHub.UI
|
|||
/// <summary>
|
||||
/// Interaction logic for CredentialsControl.xaml
|
||||
/// </summary>
|
||||
public partial class CredentialsControl: DialogUserControl
|
||||
public partial class CredentialsControl : DialogUserControl
|
||||
{
|
||||
public CredentialsControl()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<UserControl
|
||||
<UserControl
|
||||
x:Class="GitHub.UI.HorizontalShadowDivider"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GitHub.UI
|
||||
{
|
||||
public partial class HorizontalShadowDivider: UserControl
|
||||
public partial class HorizontalShadowDivider : UserControl
|
||||
{
|
||||
public HorizontalShadowDivider()
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ using System.Windows.Controls;
|
|||
|
||||
namespace GitHub.UI
|
||||
{
|
||||
public class OcticonImage: Control
|
||||
public class OcticonImage : Control
|
||||
{
|
||||
public Octicon Icon
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace GitHub.UI
|
|||
/// scaled octicon correctly position you'll have to explicitly set the height of the path to
|
||||
/// 1024 and wrap it in a viewbox to scale it down to the size you want.
|
||||
/// </summary>
|
||||
public class OcticonPath: Shape
|
||||
public class OcticonPath : Shape
|
||||
{
|
||||
private static readonly Lazy<Dictionary<Octicon, Lazy<Geometry>>> cache =
|
||||
new Lazy<Dictionary<Octicon, Lazy<Geometry>>>(PrepareCache);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<sharedControls:DialogUserControl
|
||||
<sharedControls:DialogUserControl
|
||||
x:Class="GitHub.UI.TwoFactorControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
|
|
@ -3,7 +3,7 @@ using GitHub.Shared.Controls;
|
|||
|
||||
namespace GitHub.UI
|
||||
{
|
||||
public partial class TwoFactorControl: DialogUserControl
|
||||
public partial class TwoFactorControl : DialogUserControl
|
||||
{
|
||||
public TwoFactorControl()
|
||||
{
|
||||
|
|
|
@ -30,12 +30,12 @@ using System.Threading.Tasks;
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using GitHub.Shared.Helpers;
|
||||
using GitHub.Shared.Converters;
|
||||
using GitHub.Shared.Helpers;
|
||||
|
||||
namespace GitHub.UI
|
||||
{
|
||||
public class TwoFactorInputToTextBox: ValueConverterMarkupExtension<TwoFactorInputToTextBox>
|
||||
public class TwoFactorInputToTextBox : ValueConverterMarkupExtension<TwoFactorInputToTextBox>
|
||||
{
|
||||
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace GitHub.UI
|
|||
/// <summary>
|
||||
/// Interaction logic for TwoFactorInput.xaml
|
||||
/// </summary>
|
||||
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(""));
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace GitHub.Authentication
|
|||
/// <summary>
|
||||
/// Interaction logic for CredentialsWindow.xaml
|
||||
/// </summary>
|
||||
public partial class CredentialsWindow: AuthenticationDialogWindow
|
||||
public partial class CredentialsWindow : AuthenticationDialogWindow
|
||||
{
|
||||
public CredentialsWindow()
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// <para></para>
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace GitHub.Authentication
|
|||
/// <summary>
|
||||
/// Interaction logic for Tester.xaml
|
||||
/// </summary>
|
||||
public partial class Tester: Window
|
||||
public partial class Tester : Window
|
||||
{
|
||||
public Tester()
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ using ScopeSet = System.Collections.Generic.HashSet<string>;
|
|||
|
||||
namespace GitHub.Authentication
|
||||
{
|
||||
public sealed class TokenScope: Microsoft.Alm.Authentication.TokenScope, IEquatable<TokenScope>
|
||||
public sealed class TokenScope : Microsoft.Alm.Authentication.TokenScope, IEquatable<TokenScope>
|
||||
{
|
||||
public static readonly TokenScope None = new TokenScope(string.Empty);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ using GitHub.Shared.Controls;
|
|||
|
||||
namespace GitHub.Authentication
|
||||
{
|
||||
public partial class TwoFactorWindow: AuthenticationDialogWindow
|
||||
public partial class TwoFactorWindow : AuthenticationDialogWindow
|
||||
{
|
||||
public TwoFactorWindow()
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ using GitHub.Shared.ViewModels.Validation;
|
|||
|
||||
namespace GitHub.Authentication.ViewModels
|
||||
{
|
||||
public class CredentialsViewModel: DialogViewModel
|
||||
public class CredentialsViewModel : DialogViewModel
|
||||
{
|
||||
public CredentialsViewModel()
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace GitHub.Authentication.ViewModels
|
|||
/// <summary>
|
||||
/// Simple view model for the GitHub Two Factor dialog.
|
||||
/// </summary>
|
||||
public class TwoFactorViewModel: DialogViewModel
|
||||
public class TwoFactorViewModel : DialogViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used by the GitHub.Authentication test application
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Net.Compilers" version="2.2.0" targetFramework="net451" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -29,7 +29,7 @@ using GitHub.Shared.ViewModels;
|
|||
|
||||
namespace GitHub.Shared.Controls
|
||||
{
|
||||
public abstract class AuthenticationDialogWindow: Window
|
||||
public abstract class AuthenticationDialogWindow : Window
|
||||
{
|
||||
protected AuthenticationDialogWindow()
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.Windows.Threading;
|
|||
|
||||
namespace GitHub.Shared.Controls
|
||||
{
|
||||
public abstract class DialogUserControl: UserControl
|
||||
public abstract class DialogUserControl : UserControl
|
||||
{
|
||||
protected DialogUserControl()
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace GitHub.Shared.Controls
|
|||
/// make a difference.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public class MaskedPasswordBox: PromptTextBox
|
||||
public class MaskedPasswordBox : PromptTextBox
|
||||
{
|
||||
// Fake char to display in Visual Tree
|
||||
private const char pwdChar = '●';
|
||||
|
|
|
@ -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(""));
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Windows;
|
|||
namespace GitHub.Shared.Converters
|
||||
{
|
||||
[Localizability(LocalizationCategory.NeverLocalize)]
|
||||
public sealed class BooleanToHiddenVisibilityConverter: ValueConverterMarkupExtension<BooleanToHiddenVisibilityConverter>
|
||||
public sealed class BooleanToHiddenVisibilityConverter : ValueConverterMarkupExtension<BooleanToHiddenVisibilityConverter>
|
||||
{
|
||||
public override object Convert(
|
||||
object value,
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Windows;
|
|||
namespace GitHub.Shared.Converters
|
||||
{
|
||||
[Localizability(LocalizationCategory.NeverLocalize)]
|
||||
public sealed class BooleanToInverseHiddenVisibilityConverter: ValueConverterMarkupExtension<BooleanToInverseHiddenVisibilityConverter>
|
||||
public sealed class BooleanToInverseHiddenVisibilityConverter : ValueConverterMarkupExtension<BooleanToInverseHiddenVisibilityConverter>
|
||||
{
|
||||
public override object Convert(object value,
|
||||
Type targetType,
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Windows;
|
|||
namespace GitHub.Shared.Converters
|
||||
{
|
||||
[Localizability(LocalizationCategory.NeverLocalize)]
|
||||
public sealed class BooleanToVisibilityConverter: ValueConverterMarkupExtension<BooleanToVisibilityConverter>
|
||||
public sealed class BooleanToVisibilityConverter : ValueConverterMarkupExtension<BooleanToVisibilityConverter>
|
||||
{
|
||||
private readonly System.Windows.Controls.BooleanToVisibilityConverter converter = new System.Windows.Controls.BooleanToVisibilityConverter();
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace GitHub.Shared.Converters
|
|||
/// looking at theirs because I know mine will be better. ;)
|
||||
/// </remarks>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public abstract class ValueConverterMarkupExtension<T>: MarkupExtension, IValueConverter where T : class, IValueConverter, new()
|
||||
public abstract class ValueConverterMarkupExtension<T> : MarkupExtension, IValueConverter where T : class, IValueConverter, new()
|
||||
{
|
||||
private static T converter;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace GitHub.Shared.Helpers
|
|||
/// <summary>
|
||||
/// Command that performs the specified action when invoked.
|
||||
/// </summary>
|
||||
public class ActionCommand: ICommand
|
||||
public class ActionCommand : ICommand
|
||||
{
|
||||
private Action<object> _commandAction;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace GitHub.Shared.Helpers
|
|||
/// <summary>
|
||||
/// Command that opens a browser to the URL specified by the command parameter.
|
||||
/// </summary>
|
||||
public class HyperLinkCommand: ActionCommand
|
||||
public class HyperLinkCommand : ActionCommand
|
||||
{
|
||||
public HyperLinkCommand() : base(ExecuteNavigateUrl)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
namespace GitHub.Shared.ViewModels
|
||||
{
|
||||
public class DialogViewModel: ViewModel
|
||||
public class DialogViewModel : ViewModel
|
||||
{
|
||||
private AuthenticationDialogResult _result = AuthenticationDialogResult.None;
|
||||
|
||||
|
|
|
@ -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.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.Reflection;
|
|||
|
||||
namespace GitHub.Shared.ViewModels.Validation
|
||||
{
|
||||
public abstract class PropertyValidator: ViewModel
|
||||
public abstract class PropertyValidator : ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 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<TProperty>: PropertyValidator
|
||||
public class PropertyValidator<TProperty> : PropertyValidator
|
||||
{
|
||||
// This should only be used by PropertyValidator<TObject, TProperty>
|
||||
protected PropertyValidator() { }
|
||||
|
@ -120,7 +120,7 @@ namespace GitHub.Shared.ViewModels.Validation
|
|||
/// </summary>
|
||||
/// <typeparam name="TObject"></typeparam>
|
||||
/// <typeparam name="TProperty"></typeparam>
|
||||
public class PropertyValidator<TObject, TProperty>: PropertyValidator<TProperty> where TObject : INotifyPropertyChanged
|
||||
public class PropertyValidator<TObject, TProperty> : PropertyValidator<TProperty> where TObject : INotifyPropertyChanged
|
||||
{
|
||||
internal PropertyValidator(TObject source, Expression<Func<TObject, TProperty>> propertyExpression)
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
/// </summary>
|
||||
public class ViewModel: INotifyPropertyChanged
|
||||
public class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.18.0.0" newVersion="2.18.0.0"/>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.18.0.0" newVersion="2.18.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net462" />
|
||||
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net462" />
|
||||
<package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net462" developmentDependency="true" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Microsoft.Alm.Authentication
|
|||
/// <summary>
|
||||
/// Base authentication mechanisms for setting, retrieving, and deleting stored credentials.
|
||||
/// </summary>
|
||||
public abstract class BaseAuthentication: IAuthentication
|
||||
public abstract class BaseAuthentication : IAuthentication
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes a <see cref="Credential"/> from the storage used by the authentication object.
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.Alm.Authentication
|
|||
/// <summary>
|
||||
/// Facilitates basic authentication using simple username and password schemes.
|
||||
/// </summary>
|
||||
public sealed class BasicAuthentication: BaseAuthentication, IAuthentication
|
||||
public sealed class BasicAuthentication : BaseAuthentication, IAuthentication
|
||||
{
|
||||
public static readonly Credential NtlmCredentials = WwwAuthenticateHelper.Credentials;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Microsoft.Alm.Authentication
|
|||
/// <summary>
|
||||
/// Credentials for user authentication.
|
||||
/// </summary>
|
||||
public sealed class Credential: Secret, IEquatable<Credential>
|
||||
public sealed class Credential : Secret, IEquatable<Credential>
|
||||
{
|
||||
public static readonly Credential Empty = new Credential(string.Empty, string.Empty);
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -219,7 +219,7 @@ namespace Microsoft.Alm.Authentication
|
|||
UsernameTarget = 0x04,
|
||||
}
|
||||
|
||||
internal enum CredentialPersist: uint
|
||||
internal enum CredentialPersist : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>The ` <see cref="Credential"/>` persists for the life of the logon session.</para>
|
||||
|
@ -261,7 +261,7 @@ namespace Microsoft.Alm.Authentication
|
|||
Enterprise = 0x03
|
||||
}
|
||||
|
||||
internal enum CredentialType: uint
|
||||
internal enum CredentialType : uint
|
||||
{
|
||||
/// <summary> <para>The `<see cref="Credential"/>` is a generic credential. The
|
||||
/// credential will not be used by any particular authentication package.</para>
|
||||
|
|
|
@ -56,8 +56,7 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1055:UriReturnValuesShouldNotBeStrings")]
|
||||
public static string UriToActualUrl(TargetUri targetUri, string @namespace)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
/// </summary>
|
||||
public sealed class SecretStore: BaseSecureStore, ICredentialStore, ITokenStore
|
||||
public sealed class SecretStore : BaseSecureStore, ICredentialStore, ITokenStore
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SecretStore"/> backed by the operating system keychain / secrets vault.
|
||||
|
|
|
@ -310,10 +310,10 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a version of this <see cref="TargetUri"/> that contains the specified username.
|
||||
/// Get a version of this <see cref="TargetUri"/> that contains the specified username.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the <see cref="TargetUri"/> already contains a username, that one is kept NOT overwritten.
|
||||
/// If the <see cref="TargetUri"/> already contains a username, that one is kept NOT overwritten.
|
||||
/// </remarks>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings")]
|
||||
public TargetUri GetPerUserTargetUri(string username)
|
||||
|
@ -329,7 +329,7 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a version of this <see cref="TargetUri"/> that does NOT contain any username.
|
||||
/// Get a version of this <see cref="TargetUri"/> that does NOT contain any username.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings")]
|
||||
|
@ -346,14 +346,14 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the ActualUri of this <see cref="TargetUri"/> contains UserInfo
|
||||
/// Determine if the ActualUri of this <see cref="TargetUri"/> contains UserInfo
|
||||
/// </summary>
|
||||
public bool TargetUriContainsUsername{ get { return ActualUri.AbsoluteUri.Contains("@"); }}
|
||||
public bool TargetUriContainsUsername { get { return ActualUri.AbsoluteUri.Contains("@"); } }
|
||||
|
||||
/// <summary>
|
||||
/// Get username contained in the ActualUri of this <see cref="TargetUri"/>
|
||||
/// Get username contained in the ActualUri of this <see cref="TargetUri"/>
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
|
||||
public string TargetUriUsername { get { return ActualUri.UserInfo; } }
|
||||
public string TargetUriUsername { get { return ActualUri.UserInfo; } }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.Alm.Authentication
|
|||
/// <summary>
|
||||
/// A security token, usually acquired by some authentication and identity services.
|
||||
/// </summary>
|
||||
public class Token: Secret, IEquatable<Token>
|
||||
public class Token : Secret, IEquatable<Token>
|
||||
{
|
||||
public static readonly StringComparer TokenComparer = StringComparer.Ordinal;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using ScopeSet = System.Collections.Generic.HashSet<string>;
|
|||
|
||||
namespace Microsoft.Alm.Authentication
|
||||
{
|
||||
public abstract class TokenScope: IEquatable<TokenScope>
|
||||
public abstract class TokenScope : IEquatable<TokenScope>
|
||||
{
|
||||
protected TokenScope(string value)
|
||||
{
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче