Skip to content

Commit 6cdffad

Browse files
committed
Added IsLoopback.
1 parent 8a6cbbe commit 6cdffad

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

NtApiDotNet/Win32/Security/Authentication/ClientAuthenticationContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ private void Dispose(bool _)
180180
/// </summary>
181181
public SchannelConnectionInfo ConnectionInfo => SecurityContextUtils.GetConnectionInfo(Context);
182182

183+
/// <summary>
184+
/// Get whether the authentication context is for loopback.
185+
/// </summary>
186+
public bool IsLoopback => SecurityContextUtils.GetIsLoopback(Context);
187+
183188
#endregion
184189

185190
#region Constructors

NtApiDotNet/Win32/Security/Authentication/SecurityContextUtils.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ internal static SecPkgContext_StreamSizes GetStreamSizes(SecHandle context)
303303
return QueryContextAttribute<SecPkgContext_StreamSizes>(context, SECPKG_ATTR.STREAM_SIZES);
304304
}
305305

306+
internal static bool GetIsLoopback(SecHandle context)
307+
{
308+
var res = QueryContextAttributeNoThrow<int>(context, SECPKG_ATTR.IS_LOOPBACK);
309+
return res.Item1 != 0;
310+
}
311+
306312
internal static ExportedSecurityContext ExportContext(SecHandle context, SecPkgContextExportFlags export_flags, string package, bool client)
307313
{
308314
if (context is null)

NtApiDotNet/Win32/Security/Authentication/ServerAuthenticationContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ private string GetTargetName()
191191
/// </summary>
192192
public X509Certificate2 RemoteCertificate => SecurityContextUtils.GetRemoteCertificate(Context);
193193

194+
/// <summary>
195+
/// Get whether the authentication context is for loopback.
196+
/// </summary>
197+
public bool IsLoopback => SecurityContextUtils.GetIsLoopback(Context);
198+
194199
#endregion
195200

196201
#region Public Methods

0 commit comments

Comments
 (0)