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

◆ AddGroupSidClaims()

void System.Security.Principal.WindowsIdentity.AddGroupSidClaims ( List< Claim > instanceClaims)
inlineprivate

Definition at line 830 of file WindowsIdentity.cs.

831 {
833 {
834 return;
835 }
838 try
839 {
841 SecurityIdentifier securityIdentifier = new SecurityIdentifier(Marshal.PtrToStructure<global::Interop.TOKEN_PRIMARY_GROUP>(safeLocalAllocHandle2.DangerousGetHandle()).PrimaryGroup);
842 bool flag = false;
844 int num = Marshal.ReadInt32(safeLocalAllocHandle.DangerousGetHandle());
845 IntPtr intPtr = new IntPtr((long)safeLocalAllocHandle.DangerousGetHandle() + (long)Marshal.OffsetOf<global::Interop.TOKEN_GROUPS>("Groups"));
846 for (int i = 0; i < num; i++)
847 {
848 global::Interop.SID_AND_ATTRIBUTES sID_AND_ATTRIBUTES = Marshal.PtrToStructure<global::Interop.SID_AND_ATTRIBUTES>(intPtr);
849 uint num2 = 3221225492u;
850 SecurityIdentifier securityIdentifier2 = new SecurityIdentifier(sID_AND_ATTRIBUTES.Sid);
851 if ((sID_AND_ATTRIBUTES.Attributes & num2) == 4)
852 {
853 Claim claim;
854 if (!flag && StringComparer.Ordinal.Equals(securityIdentifier2.Value, securityIdentifier.Value))
855 {
856 claim = new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid", securityIdentifier2.Value, "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
857 claim.Properties.Add("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority", securityIdentifier2.IdentifierAuthority.ToString());
859 flag = true;
860 }
861 claim = new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid", securityIdentifier2.Value, "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
862 claim.Properties.Add("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority", securityIdentifier2.IdentifierAuthority.ToString());
864 }
865 else if ((sID_AND_ATTRIBUTES.Attributes & num2) == 16)
866 {
867 Claim claim;
868 if (!flag && StringComparer.Ordinal.Equals(securityIdentifier2.Value, securityIdentifier.Value))
869 {
870 claim = new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroupsid", securityIdentifier2.Value, "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
871 claim.Properties.Add("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority", securityIdentifier2.IdentifierAuthority.ToString());
873 flag = true;
874 }
875 claim = new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/denyonlysid", securityIdentifier2.Value, "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
876 claim.Properties.Add("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority", securityIdentifier2.IdentifierAuthority.ToString());
878 }
879 intPtr = new IntPtr((long)intPtr + Marshal.SizeOf<global::Interop.SID_AND_ATTRIBUTES>());
880 }
881 }
882 finally
883 {
884 safeLocalAllocHandle?.Dispose();
885 safeLocalAllocHandle2?.Dispose();
886 }
887 }
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.StringComparer.Ordinal, System.Runtime.InteropServices.Marshal.PtrToStructure(), System.Runtime.InteropServices.Marshal.ReadInt32(), and System.Runtime.InteropServices.Marshal.SizeOf().

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