70 if (LogonId.LowPart == 998)
238 global::Interop.SID_AND_ATTRIBUTES[]
array =
new global::Interop.SID_AND_ATTRIBUTES[
safeLocalAllocHandle.Read<global::Interop.TOKEN_GROUPS>(0
uL).GroupCount];
240 global::Interop.SID_AND_ATTRIBUTES[]
array2 =
array;
241 for (
int i = 0; i <
array2.Length; i++)
244 uint num = 3221225492
u;
349 :
base(
null,
null,
null,
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid")
357 :
base(
null,
null,
null,
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid")
362 :
base(
null,
null,
null,
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid")
368 byte[]
array =
new byte[4] { 67, 76, 82, 0 };
370 if (!global::Interop.Advapi32.AllocateLocallyUniqueId(
out SourceContext.SourceIdentifier))
381 if (
array2.Length > 65535)
385 int num =
sizeof(global::Interop.SspiCli.KERB_S4U_LOGON) +
array2.Length;
388 ptr->MessageType = global::Interop.SspiCli.KERB_LOGON_SUBMIT_TYPE.KerbS4ULogon;
389 ptr->Flags = global::Interop.SspiCli.KerbS4uLogonFlags.None;
390 ptr->ClientUpn.Length = (
ptr->ClientUpn.MaximumLength = (ushort)
array2.Length);
394 ptr->ClientRealm.Length = (
ptr->ClientRealm.MaximumLength = 0);
402 global::Interop.LUID LogonId;
404 global::Interop.SspiCli.QUOTA_LIMITS Quotas;
406 int num3 = global::Interop.SspiCli.LsaLogonUser(
lsaHandle,
ref OriginName, global::Interop.SspiCli.SECURITY_LOGON_TYPE.Network,
authenticationPackage,
safeLocalAllocHandle.DangerousGetHandle(), num,
IntPtr.
Zero,
ref SourceContext,
out ProfileBuffer,
out ProfileBufferLength,
out LogonId,
out Token,
out Quotas,
out SubStatus);
427 int num = global::Interop.SspiCli.LsaConnectUntrusted(
out LsaHandle);
438 int AuthenticationPackage;
448 return AuthenticationPackage;
572 NTAccount nTAccount = User.Translate(typeof(NTAccount)) as NTAccount;
573 _name = nTAccount.ToString();
595 T result =
default(T);
632 bool isImpersonating;
643 if (!global::Interop.Advapi32.RevertToSelf())
648 if (!token.
IsInvalid && !global::Interop.Advapi32.ImpersonateLoggedOnUser(token))
659 if (
args.ThreadContextChanged)
661 if (!global::Interop.Advapi32.RevertToSelf())
665 if (
args.CurrentValue !=
null && !
args.CurrentValue.IsInvalid && !global::Interop.Advapi32.ImpersonateLoggedOnUser(
args.CurrentValue))
674 bool isImpersonating;
711 uint
error = global::Interop.Advapi32.LsaNtStatusToWinError((uint)status);
719 isImpersonating =
true;
729 isImpersonating =
false;
741 if (!global::Interop.Advapi32.OpenProcessToken(global::Interop.Kernel32.GetCurrentProcess(), desiredAccess,
out var TokenHandle))
792 if (identity ==
null)
811 if (!
string.IsNullOrEmpty(
Name))
846 for (
int i = 0; i < num; i++)
849 uint
num2 = 3221225492
u;
857 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier2.IdentifierAuthority.ToString());
862 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier2.IdentifierAuthority.ToString());
871 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier2.IdentifierAuthority.ToString());
876 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier2.IdentifierAuthority.ToString());
905 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier.IdentifierAuthority.ToString());
911 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier.IdentifierAuthority.ToString());
938 for (
int i = 0; i < num; i++)
941 uint
num2 = 3221225492
u;
945 string text =
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup";
947 claim.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier.IdentifierAuthority.ToString());
953 string text =
"http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlywindowsdevicegroup";
955 claim2.Properties.
Add(
"http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority",
securityIdentifier.IdentifierAuthority.ToString());
986 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING:
998 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64:
1010 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64:
1024 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN:
static SafeAccessTokenHandle InvalidHandle
static SafeLocalAllocHandle InvalidHandle
static Microsoft.Win32.SafeHandles.SafeLocalAllocHandle LocalAlloc(int cb)
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
int Initialize(int capacity)
void Add(TKey key, TValue value)
static void FailFast(string? message)
static CultureInfo InvariantCulture
static int GetHRForLastWin32Error()
static ? string PtrToStringAuto(IntPtr ptr, int len)
static int ReadInt32(object ptr, int ofs)
static unsafe? string PtrToStringUni(IntPtr ptr)
static int GetLastWin32Error()
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
static ? object PtrToStructure(IntPtr ptr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type structureType)
static int SizeOf(object structure)
static IntPtr OffsetOf(Type t, string fieldName)
void DangerousAddRef(ref bool success)
IntPtr DangerousGetHandle()
static string Argument_TokenZero
static string Argument_ImpersonateUser
static string Argument_InvalidImpersonationToken
static SafeAccessTokenHandle GetCurrentToken(TokenAccessLevels desiredAccess, bool threadOnly, out bool isImpersonating, out int hr)
static SecurityIdentifier s_authenticatedUserRid
void AddPrimarySidClaim(List< Claim > instanceClaims)
SafeAccessTokenHandle AccessToken
IdentityReferenceCollection? Groups
SecurityIdentifier _owner
unsafe WindowsIdentity(string sUserPrincipalName)
static SecurityIdentifier s_anonymousRid
volatile TokenImpersonationLevel _impersonationLevel
static void RunImpersonatedInternal(SafeAccessTokenHandle token, Action action)
override bool IsAuthenticated
static T RunImpersonated< T >(SafeAccessTokenHandle safeAccessTokenHandle, Func< T > func)
static readonly AsyncLocal< SafeAccessTokenHandle > s_currentImpersonatedToken
List< Claim > _deviceClaims
static SecurityIdentifier s_localSystemRid
WindowsIdentity(IntPtr userToken, string authType, int isAuthenticated)
static SecurityIdentifier s_domainRid
bool CheckNtTokenForSid(SecurityIdentifier sid)
static Task< T > RunImpersonatedAsync< T >(SafeAccessTokenHandle safeAccessTokenHandle, Func< Task< T > > func)
static SafeLsaHandle ConnectToLsa()
static int GetHRForWin32Error(int dwLastError)
List< Claim > _userClaims
static SafeLocalAllocHandle GetTokenInformation(SafeAccessTokenHandle tokenHandle, TokenInformationClass tokenInformationClass, bool nullOnInvalidParam=false)
SecurityIdentifier? Owner
void AddTokenClaims(List< Claim > instanceClaims, TokenInformationClass tokenInformationClass, string propertyValue)
virtual IEnumerable< Claim > UserClaims
WindowsIdentity(IntPtr userToken, string type, WindowsAccountType acctType, bool isAuthenticated)
static WindowsIdentity GetCurrentInternal(TokenAccessLevels desiredAccess, bool threadOnly)
WindowsIdentity(IntPtr userToken, string type, WindowsAccountType acctType)
virtual IEnumerable< Claim > DeviceClaims
static void RunImpersonated(SafeAccessTokenHandle safeAccessTokenHandle, Action action)
static Exception GetExceptionFromNtStatus(int status)
static ? WindowsIdentity GetCurrent(bool ifImpersonating)
static SafeAccessTokenHandle DuplicateAccessToken(IntPtr accessToken)
object _claimsIntiailizedLock
WindowsIdentity(WindowsIdentity identity)
readonly string _authType
override ClaimsIdentity Clone()
static bool s_ignoreWindows8Properties
static global::Interop.LUID GetLogonAuthId(SafeAccessTokenHandle safeTokenHandle)
const new string DefaultIssuer
T GetTokenInformation< T >(TokenInformationClass tokenInformationClass)
static WindowsIdentity GetCurrent()
static void CurrentImpersonatedTokenChanged(AsyncLocalValueChangedArgs< SafeAccessTokenHandle > args)
static SafeAccessTokenHandle GetCurrentProcessToken(TokenAccessLevels desiredAccess, out int hr)
IdentityReferenceCollection _groups
WindowsIdentity(IntPtr userToken, string type)
readonly string _issuerName
static unsafe int LookupAuthenticationPackage(SafeLsaHandle lsaHandle, string packageName)
void CreateFromToken(IntPtr userToken)
WindowsIdentity(IntPtr userToken)
SafeAccessTokenHandle _safeTokenHandle
TokenImpersonationLevel ImpersonationLevel
WindowsIdentity(SerializationInfo info, StreamingContext context)
static Task RunImpersonatedAsync(SafeAccessTokenHandle safeAccessTokenHandle, Func< Task > func)
static WindowsIdentity GetAnonymous()
static WindowsIdentity GetCurrent(TokenAccessLevels desiredAccess)
static string GetAuthType(WindowsIdentity identity)
void AddGroupSidClaims(List< Claim > instanceClaims)
static SafeAccessTokenHandle DuplicateAccessToken(SafeAccessTokenHandle accessToken)
override? string AuthenticationType
void AddDeviceGroupSidClaims(List< Claim > instanceClaims, TokenInformationClass tokenInformationClass)
volatile bool _impersonationLevelInitialized
virtual void Dispose(bool disposing)
static StringComparer Ordinal
static ? ExecutionContext Capture()
static void Run(ExecutionContext executionContext, ContextCallback callback, object? state)
static int CompareExchange(ref int location1, int value, int comparand)
void OnDeserialization(object? sender)
void GetObjectData(SerializationInfo info, StreamingContext context)
static readonly IntPtr Zero