Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddDeviceGroupSidClaims()

void System.Security.Principal.WindowsIdentity.AddDeviceGroupSidClaims ( List< Claim > instanceClaims,
TokenInformationClass tokenInformationClass )
inlineprivate

Definition at line 921 of file WindowsIdentity.cs.

922 {
924 {
925 return;
926 }
928 try
929 {
931 if (safeLocalAllocHandle == null)
932 {
934 return;
935 }
936 int num = Marshal.ReadInt32(safeLocalAllocHandle.DangerousGetHandle());
937 IntPtr intPtr = new IntPtr((long)safeLocalAllocHandle.DangerousGetHandle() + (long)Marshal.OffsetOf(typeof(global::Interop.TOKEN_GROUPS), "Groups"));
938 for (int i = 0; i < num; i++)
939 {
940 global::Interop.SID_AND_ATTRIBUTES sID_AND_ATTRIBUTES = (global::Interop.SID_AND_ATTRIBUTES)Marshal.PtrToStructure(intPtr, typeof(global::Interop.SID_AND_ATTRIBUTES));
941 uint num2 = 3221225492u;
942 SecurityIdentifier securityIdentifier = new SecurityIdentifier(sID_AND_ATTRIBUTES.Sid);
943 if ((sID_AND_ATTRIBUTES.Attributes & num2) == 4)
944 {
945 string text = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup";
946 Claim claim = new Claim(text, securityIdentifier.Value, "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
947 claim.Properties.Add("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority", securityIdentifier.IdentifierAuthority.ToString());
948 claim.Properties.Add(text, "");
950 }
951 else if ((sID_AND_ATTRIBUTES.Attributes & num2) == 16)
952 {
953 string text = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlywindowsdevicegroup";
954 Claim claim2 = new Claim(text, securityIdentifier.Value, "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
955 claim2.Properties.Add("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority", securityIdentifier.IdentifierAuthority.ToString());
956 claim2.Properties.Add(text, "");
958 }
959 intPtr = new IntPtr((long)intPtr + Marshal.SizeOf<global::Interop.SID_AND_ATTRIBUTES>());
960 }
961 }
962 finally
963 {
964 safeLocalAllocHandle?.Dispose();
965 }
966 }
void Add(TKey key, TValue value)
static int ReadInt32(object ptr, int ofs)
Definition Marshal.cs:59
static ? object PtrToStructure(IntPtr ptr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type structureType)
Definition Marshal.cs:1164
static int SizeOf(object structure)
Definition Marshal.cs:697
static IntPtr OffsetOf(Type t, string fieldName)
Definition Marshal.cs:28
static SafeLocalAllocHandle GetTokenInformation(SafeAccessTokenHandle tokenHandle, TokenInformationClass tokenInformationClass, bool nullOnInvalidParam=false)

References System.Security.Principal.WindowsIdentity._issuerName, System.Security.Principal.WindowsIdentity._safeTokenHandle, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Runtime.Serialization.Dictionary, System.Security.Principal.WindowsIdentity.GetTokenInformation(), Microsoft.Win32.SafeHandles.SafeAccessTokenHandle.IsInvalid, System.Runtime.InteropServices.Marshal.OffsetOf(), System.Runtime.InteropServices.Marshal.PtrToStructure(), System.Runtime.InteropServices.Marshal.ReadInt32(), System.Security.Principal.WindowsIdentity.s_ignoreWindows8Properties, System.Runtime.InteropServices.Marshal.SizeOf(), and System.text.

Referenced by System.Security.Principal.WindowsIdentity.InitializeClaims().