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

◆ GetThreadPrincipal()

IPrincipal System.AppDomain.GetThreadPrincipal ( )
inlinepackage

Definition at line 490 of file AppDomain.cs.

491 {
492 IPrincipal principal = _defaultPrincipal;
493 if (principal == null)
494 {
495 switch (_principalPolicy)
496 {
497 case PrincipalPolicy.UnauthenticatedPrincipal:
499 {
500 Type type2 = Type.GetType("System.Security.Principal.GenericPrincipal, System.Security.Claims", throwOnError: true);
501 MethodInfo method2 = type2.GetMethod("GetDefaultInstance", BindingFlags.Static | BindingFlags.NonPublic);
502 Volatile.Write(ref s_getUnauthenticatedPrincipal, method2.CreateDelegate<Func<IPrincipal>>());
503 }
504 principal = s_getUnauthenticatedPrincipal();
505 break;
506 case PrincipalPolicy.WindowsPrincipal:
507 if (s_getWindowsPrincipal == null)
508 {
509 Type type = Type.GetType("System.Security.Principal.WindowsPrincipal, System.Security.Principal.Windows", throwOnError: true);
510 MethodInfo method = type.GetMethod("GetDefaultInstance", BindingFlags.Static | BindingFlags.NonPublic);
511 if (method == null)
512 {
513 throw new PlatformNotSupportedException(SR.PlatformNotSupported_Principal);
514 }
515 Volatile.Write(ref s_getWindowsPrincipal, method.CreateDelegate<Func<IPrincipal>>());
516 }
517 principal = s_getWindowsPrincipal();
518 break;
519 }
520 }
521 return principal;
522 }
Func< IPrincipal > s_getUnauthenticatedPrincipal
Definition AppDomain.cs:26
PrincipalPolicy _principalPolicy
Definition AppDomain.cs:22
Func< IPrincipal > s_getWindowsPrincipal
Definition AppDomain.cs:24
IPrincipal _defaultPrincipal
Definition AppDomain.cs:20
virtual Delegate CreateDelegate(Type delegateType)
Definition MethodInfo.cs:48
static void Write(ref bool location, bool value)
Definition Volatile.cs:74

References System.AppDomain._defaultPrincipal, System.AppDomain._principalPolicy, System.Reflection.MethodInfo.CreateDelegate(), System.Type.GetMethod(), System.Type.GetType(), System.SR.PlatformNotSupported_Principal, System.AppDomain.s_getUnauthenticatedPrincipal, System.AppDomain.s_getWindowsPrincipal, System.type, and System.Threading.Volatile.Write().