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

◆ AddTokenClaims()

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

Definition at line 968 of file WindowsIdentity.cs.

969 {
971 {
972 return;
973 }
975 try
976 {
978 global::Interop.CLAIM_SECURITY_ATTRIBUTES_INFORMATION cLAIM_SECURITY_ATTRIBUTES_INFORMATION = (global::Interop.CLAIM_SECURITY_ATTRIBUTES_INFORMATION)Marshal.PtrToStructure(safeLocalAllocHandle.DangerousGetHandle(), typeof(global::Interop.CLAIM_SECURITY_ATTRIBUTES_INFORMATION));
979 long num = 0L;
980 for (int i = 0; i < cLAIM_SECURITY_ATTRIBUTES_INFORMATION.AttributeCount; i++)
981 {
982 IntPtr ptr = new IntPtr(cLAIM_SECURITY_ATTRIBUTES_INFORMATION.Attribute.pAttributeV1.ToInt64() + num);
983 global::Interop.CLAIM_SECURITY_ATTRIBUTE_V1 structure = (global::Interop.CLAIM_SECURITY_ATTRIBUTE_V1)Marshal.PtrToStructure(ptr, typeof(global::Interop.CLAIM_SECURITY_ATTRIBUTE_V1));
984 switch (structure.ValueType)
985 {
986 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING:
987 {
988 IntPtr[] array4 = new IntPtr[structure.ValueCount];
989 Marshal.Copy(structure.Values.ppString, array4, 0, (int)structure.ValueCount);
990 for (int m = 0; m < structure.ValueCount; m++)
991 {
992 Claim claim4 = new Claim(structure.Name, Marshal.PtrToStringAuto(array4[m]), "http://www.w3.org/2001/XMLSchema#string", _issuerName, _issuerName, this);
993 claim4.Properties.Add(propertyValue, string.Empty);
995 }
996 break;
997 }
998 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64:
999 {
1000 long[] array2 = new long[structure.ValueCount];
1001 Marshal.Copy(structure.Values.pInt64, array2, 0, (int)structure.ValueCount);
1002 for (int k = 0; k < structure.ValueCount; k++)
1003 {
1004 Claim claim2 = new Claim(structure.Name, array2[k].ToString(CultureInfo.InvariantCulture), "http://www.w3.org/2001/XMLSchema#integer64", _issuerName, _issuerName, this);
1005 claim2.Properties.Add(propertyValue, string.Empty);
1007 }
1008 break;
1009 }
1010 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64:
1011 {
1012 long[] array3 = new long[structure.ValueCount];
1013 Marshal.Copy(structure.Values.pUint64, array3, 0, (int)structure.ValueCount);
1014 for (int l = 0; l < structure.ValueCount; l++)
1015 {
1016 string name = structure.Name;
1017 ulong num2 = (ulong)array3[l];
1018 Claim claim3 = new Claim(name, num2.ToString(CultureInfo.InvariantCulture), "http://www.w3.org/2001/XMLSchema#uinteger64", _issuerName, _issuerName, this);
1019 claim3.Properties.Add(propertyValue, string.Empty);
1021 }
1022 break;
1023 }
1024 case global::Interop.ClaimSecurityAttributeType.CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN:
1025 {
1026 long[] array = new long[structure.ValueCount];
1027 Marshal.Copy(structure.Values.pUint64, array, 0, (int)structure.ValueCount);
1028 for (int j = 0; j < structure.ValueCount; j++)
1029 {
1030 Claim claim = new Claim(structure.Name, (array[j] != 0).ToString(), "http://www.w3.org/2001/XMLSchema#boolean", _issuerName, _issuerName, this);
1031 claim.Properties.Add(propertyValue, string.Empty);
1033 }
1034 break;
1035 }
1036 }
1037 num += Marshal.SizeOf(structure);
1038 }
1039 }
1040 finally
1041 {
1042 safeLocalAllocHandle?.Dispose();
1043 }
1044 }
void Add(TKey key, TValue value)
static CultureInfo InvariantCulture
static ? string PtrToStringAuto(IntPtr ptr, int len)
Definition Marshal.cs:1572
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
Definition Marshal.cs:800
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 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.array, System.Runtime.InteropServices.Marshal.Copy(), System.Runtime.Serialization.Dictionary, System.Security.Principal.WindowsIdentity.GetTokenInformation(), System.Globalization.CultureInfo.InvariantCulture, Microsoft.Win32.SafeHandles.SafeAccessTokenHandle.IsInvalid, System.L, System.Runtime.InteropServices.Marshal.PtrToStringAuto(), System.Runtime.InteropServices.Marshal.PtrToStructure(), System.Runtime.InteropServices.Marshal.SizeOf(), and System.Collections.Generic.Dictionary< TKey, TValue >.Values.

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