Renamed Client/ServerCredential.

The credential implementations should indicate in their name that they are implementations of the 'current' credential (acquired from the login running the process).
This commit is contained in:
Kevin Thompson
2017-09-24 01:59:34 -04:00
parent 0eb8ff49f2
commit f2d4541bab
6 changed files with 14 additions and 14 deletions

View File

@@ -5,13 +5,13 @@ namespace NSspi.Credentials
/// <summary> /// <summary>
/// Represents the credentials of the user running the current process, for use as an SSPI client. /// Represents the credentials of the user running the current process, for use as an SSPI client.
/// </summary> /// </summary>
public class ClientCredential : CurrentCredential public class ClientCurrentCredential : CurrentCredential
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the ClientCredential class. /// Initializes a new instance of the ClientCredential class.
/// </summary> /// </summary>
/// <param name="package">The security package to acquire the credential handle from.</param> /// <param name="package">The security package to acquire the credential handle from.</param>
public ClientCredential( string package ) public ClientCurrentCredential( string package )
: base( package, CredentialUse.Outbound ) : base( package, CredentialUse.Outbound )
{ {
} }

View File

@@ -5,14 +5,14 @@ namespace NSspi.Credentials
/// <summary> /// <summary>
/// Represents the credentials of the user running the current process, for use as an SSPI server. /// Represents the credentials of the user running the current process, for use as an SSPI server.
/// </summary> /// </summary>
public class ServerCredential : CurrentCredential public class ServerCurrentCredential : CurrentCredential
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the ServerCredential class, acquiring credentials from /// Initializes a new instance of the ServerCredential class, acquiring credentials from
/// the current thread's security context. /// the current thread's security context.
/// </summary> /// </summary>
/// <param name="package">The name of the security package to obtain credentials from.</param> /// <param name="package">The name of the security package to obtain credentials from.</param>
public ServerCredential( string package ) public ServerCurrentCredential( string package )
: base( package, CredentialUse.Inbound ) : base( package, CredentialUse.Inbound )
{ {
} }

View File

@@ -55,18 +55,18 @@
<Compile Include="Contexts\ContextQueryAttrib.cs" /> <Compile Include="Contexts\ContextQueryAttrib.cs" />
<Compile Include="Contexts\ImpersonationHandle.cs" /> <Compile Include="Contexts\ImpersonationHandle.cs" />
<Compile Include="Contexts\SafeContextHandle.cs" /> <Compile Include="Contexts\SafeContextHandle.cs" />
<Compile Include="Credentials\ClientCurrentCredential.cs" />
<Compile Include="Credentials\CurrentCredential.cs" /> <Compile Include="Credentials\CurrentCredential.cs" />
<Compile Include="Credentials\ServerCurrentCredential.cs" />
<Compile Include="EnumMgr.cs" /> <Compile Include="EnumMgr.cs" />
<Compile Include="SecPkgInfo.cs" /> <Compile Include="SecPkgInfo.cs" />
<Compile Include="Contexts\ServerContext.cs" /> <Compile Include="Contexts\ServerContext.cs" />
<Compile Include="Credentials\ClientCredential.cs" />
<Compile Include="Credentials\Credential.cs" /> <Compile Include="Credentials\Credential.cs" />
<Compile Include="Credentials\CredentialNativeMethods.cs" /> <Compile Include="Credentials\CredentialNativeMethods.cs" />
<Compile Include="Credentials\CredentialQueryAttrib.cs" /> <Compile Include="Credentials\CredentialQueryAttrib.cs" />
<Compile Include="Credentials\CredentialUse.cs" /> <Compile Include="Credentials\CredentialUse.cs" />
<Compile Include="Credentials\QueryNameSupport.cs" /> <Compile Include="Credentials\QueryNameSupport.cs" />
<Compile Include="Credentials\SafeCredentialHandle.cs" /> <Compile Include="Credentials\SafeCredentialHandle.cs" />
<Compile Include="Credentials\ServerCredential.cs" />
<Compile Include="NativeMethods.cs" /> <Compile Include="NativeMethods.cs" />
<Compile Include="PackageSupport.cs" /> <Compile Include="PackageSupport.cs" />
<Compile Include="PackageNames.cs" /> <Compile Include="PackageNames.cs" />

View File

@@ -16,10 +16,10 @@ namespace NSspi
private static void CredTest( string packageName ) private static void CredTest( string packageName )
{ {
ClientCredential clientCred = null; ClientCurrentCredential clientCred = null;
ClientContext client = null; ClientContext client = null;
ServerCredential serverCred = null; ServerCurrentCredential serverCred = null;
ServerContext server = null; ServerContext server = null;
byte[] clientToken; byte[] clientToken;
@@ -30,8 +30,8 @@ namespace NSspi
try try
{ {
clientCred = new ClientCredential( packageName ); clientCred = new ClientCurrentCredential( packageName );
serverCred = new ServerCredential( packageName ); serverCred = new ServerCurrentCredential( packageName );
Console.Out.WriteLine( clientCred.PrincipleName ); Console.Out.WriteLine( clientCred.PrincipleName );

View File

@@ -14,7 +14,7 @@ namespace TestClient
public partial class ClientForm : Form public partial class ClientForm : Form
{ {
private ClientContext context; private ClientContext context;
private ClientCredential cred; private ClientCurrentCredential cred;
private CustomConnection connection; private CustomConnection connection;
@@ -42,7 +42,7 @@ namespace TestClient
this.FormClosing += Form1_FormClosing; this.FormClosing += Form1_FormClosing;
// --- SSPI --- // --- SSPI ---
this.cred = new ClientCredential( PackageNames.Negotiate ); this.cred = new ClientCurrentCredential( PackageNames.Negotiate );
this.context = new ClientContext( this.context = new ClientContext(
cred, cred,

View File

@@ -13,7 +13,7 @@ namespace TestServer
public partial class ServerForm : Form public partial class ServerForm : Form
{ {
private ServerCredential serverCred; private ServerCurrentCredential serverCred;
private ServerContext serverContext; private ServerContext serverContext;
@@ -29,7 +29,7 @@ namespace TestServer
{ {
InitializeComponent(); InitializeComponent();
this.serverCred = new ServerCredential( PackageNames.Negotiate ); this.serverCred = new ServerCurrentCredential( PackageNames.Negotiate );
this.serverContext = new ServerContext( this.serverContext = new ServerContext(
serverCred, serverCred,