本文整理汇总了C#中System.Security.SecurityContext类的典型用法代码示例。如果您正苦于以下问题:C# SecurityContext类的具体用法?C# SecurityContext怎么用?C# SecurityContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecurityContext类属于System.Security命名空间,在下文中一共展示了SecurityContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Setup
internal void Setup(SecurityContextDisableFlow flags)
{
this.useEC = false;
this._sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
this._sc._disableFlow = flags;
this._thread = Thread.CurrentThread;
}
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:AsyncFlowControl.cs
示例2: Schedule
protected void Schedule()
{
if (!this.isScheduled)
{
this.isScheduled = true;
if (PartialTrustHelpers.ShouldFlowSecurityContext)
{
this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow();
}
if (this.context == null)
{
this.ScheduleCallback(ActionItem.CallbackHelper.InvokeWithoutContextCallback);
return;
}
else
{
this.ScheduleCallback(ActionItem.CallbackHelper.InvokeWithContextCallback);
return;
}
}
else
{
throw Fx.Exception.AsError(new InvalidOperationException(InternalSR.ActionItemIsAlreadyScheduled));
}
}
开发者ID:nickchal,项目名称:pash,代码行数:25,代码来源:ActionItem.cs
示例3: SecurityContext
// copy constructor
internal SecurityContext (SecurityContext sc)
{
_capture = true;
_winid = sc._winid;
if (sc._stack != null)
_stack = sc._stack.CreateCopy ();
}
开发者ID:ngraziano,项目名称:mono,代码行数:8,代码来源:SecurityContext.cs
示例4: ExecutionContext
internal ExecutionContext (ExecutionContext ec)
{
if (ec._sc != null)
_sc = new SecurityContext (ec._sc);
_suppressFlow = ec._suppressFlow;
_capture = true;
}
开发者ID:ramonsmits,项目名称:mono,代码行数:7,代码来源:ExecutionContext.cs
示例5: SecurityContext
// copy constructor
internal SecurityContext (SecurityContext sc)
{
_capture = true;
#if !MOBILE
_winid = sc._winid;
if (sc._stack != null)
_stack = sc._stack.CreateCopy ();
#endif
}
开发者ID:carrie901,项目名称:mono,代码行数:10,代码来源:SecurityContext.cs
示例6: ExecutionContext
internal ExecutionContext (ExecutionContext ec)
{
#if !MOONLIGHT
if (ec._sc != null)
_sc = new SecurityContext (ec._sc);
#endif
_suppressFlow = ec._suppressFlow;
_capture = true;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:ExecutionContext.cs
示例7: ExecutionContext
internal ExecutionContext (ExecutionContext ec)
{
#if !NET_2_1 || MONOTOUCH
if (ec._sc != null)
_sc = new SecurityContext (ec._sc);
#endif
_suppressFlow = ec._suppressFlow;
_capture = true;
}
开发者ID:runefs,项目名称:Marvin,代码行数:9,代码来源:ExecutionContext.cs
示例8: Capture
// static methods
static public SecurityContext Capture ()
{
SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
if (sc.FlowSuppressed)
return null;
SecurityContext capture = new SecurityContext ();
capture._capture = true;
capture._winid = WindowsIdentity.GetCurrentToken ();
capture._stack = CompressedStack.Capture ();
return capture;
}
开发者ID:ngraziano,项目名称:mono,代码行数:14,代码来源:SecurityContext.cs
示例9: ExecutionContext
private ExecutionContext (ExecutionContext ec)
{
#if !MOBILE
if (ec._sc != null)
_sc = new SecurityContext (ec._sc);
#endif
if (ec._lcc != null)
_lcc = (LogicalCallContext) ec._lcc.Clone ();
_suppressFlow = ec._suppressFlow;
_capture = true;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:12,代码来源:ExecutionContext.cs
示例10: Schedule
protected void Schedule()
{
if (isScheduled)
{
throw Fx.Exception.AsError(new InvalidOperationException(CommonResources.ActionItemIsAlreadyScheduled));
}
this.isScheduled = true;
if (PartialTrustHelpers.ShouldFlowSecurityContext)
{
this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow();
}
if (this.context != null)
{
ScheduleCallback(CallbackHelper.InvokeWithContextCallback);
}
else
{
ScheduleCallback(CallbackHelper.InvokeWithoutContextCallback);
}
}
开发者ID:stefangordon,项目名称:azure-iot-sdks,代码行数:21,代码来源:ActionItem.cs
示例11: Schedule
protected void Schedule()
{
if (isScheduled)
{
throw Fx.Exception.AsError(new InvalidOperationException(InternalSR.ActionItemIsAlreadyScheduled));
}
this.isScheduled = true;
#if FEATURE_COMPRESSEDSTACK
if (PartialTrustHelpers.ShouldFlowSecurityContext)
{
this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow();
}
if (this.context != null)
{
ScheduleCallback(CallbackHelper.InvokeWithContextCallback);
}
else
#endif
{
ScheduleCallback(CallbackHelper.InvokeWithoutContextCallback);
}
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:23,代码来源:ActionItem.cs
示例12: SetSecurityContext
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
internal static SecurityContextSwitcher SetSecurityContext(SecurityContext sc, SecurityContext.Reader prevSecurityContext, bool modifyCurrentExecutionContext)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return SetSecurityContext(sc, prevSecurityContext, modifyCurrentExecutionContext, ref stackMark);
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:6,代码来源:securitycontext.cs
示例13: SecurityContextRunData
internal SecurityContextRunData(SecurityContext securityContext, ContextCallback cb, Object state)
{
this.sc = securityContext;
this.callBack = cb;
this.state = state;
this.scsw = new SecurityContextSwitcher();
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:7,代码来源:securitycontext.cs
示例14: RunInternal
[System.Security.SecurityCritical] // auto-generated
internal static void RunInternal(SecurityContext securityContext, ContextCallback callBack, Object state)
{
if (cleanupCode == null)
{
tryCode = new RuntimeHelpers.TryCode(runTryCode);
cleanupCode = new RuntimeHelpers.CleanupCode(runFinallyCode);
}
SecurityContextRunData runData = new SecurityContextRunData(securityContext, callBack, state);
RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(tryCode, cleanupCode, runData);
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:12,代码来源:securitycontext.cs
示例15: Run
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static void Run(SecurityContext securityContext, ContextCallback callback, Object state)
{
if (securityContext == null )
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NullContext"));
}
Contract.EndContractBlock();
StackCrawlMark stackMark = StackCrawlMark.LookForMe;
if (!securityContext.isNewCapture)
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotNewCaptureContext"));
}
securityContext.isNewCapture = false;
#if !MOBILE
ExecutionContext.Reader ec = Thread.CurrentThread.GetExecutionContextReader();
// Optimization: do the callback directly if both the current and target contexts are equal to the
// default full-trust security context
if ( SecurityContext.CurrentlyInDefaultFTSecurityContext(ec)
&& securityContext.IsDefaultFTSecurityContext())
{
callback(state);
if (GetCurrentWI(Thread.CurrentThread.GetExecutionContextReader()) != null)
{
// If we enter here it means the callback did an impersonation
// that we need to revert.
// We don't need to revert any other security state since it is stack-based
// and automatically goes away when the callback returns.
WindowsIdentity.SafeRevertToSelf(ref stackMark);
// Ensure we have reverted to the state we entered in.
Contract.Assert(GetCurrentWI(Thread.CurrentThread.GetExecutionContextReader()) == null);
}
}
else
#endif
{
RunInternal(securityContext, callback, state);
}
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:45,代码来源:securitycontext.cs
示例16: IsSame
public bool IsSame(SecurityContext.Reader sc) { return m_sc == sc.m_sc; }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:1,代码来源:securitycontext.cs
示例17: SetSecurityContext
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
internal static SecurityContextSwitcher SetSecurityContext(SecurityContext sc, SecurityContext prevSecurityContext)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return SetSecurityContext(sc, prevSecurityContext, ref stackMark);
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:6,代码来源:SecurityContext.cs
示例18: CreateFullTrustSecurityContext
[System.Security.SecurityCritical] // auto-generated
static internal SecurityContext CreateFullTrustSecurityContext()
{
SecurityContext sc = new SecurityContext();
sc.isNewCapture = true;
#if !FEATURE_PAL && FEATURE_IMPERSONATION
if (IsWindowsIdentityFlowSuppressed())
{
sc._disableFlow = SecurityContextDisableFlow.WI;
}
#endif // !FEATURE_PAL && FEATURE_IMPERSONATION
#if FEATURE_COMPRESSEDSTACK
// Force create CompressedStack
sc.CompressedStack = new CompressedStack(null);
#endif
return sc;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:19,代码来源:securitycontext.cs
示例19: CreateMutableCopy
[System.Security.SecuritySafeCritical] // auto-generated
internal SecurityContext CreateMutableCopy()
{
Contract.Assert(!this.isNewCapture);
SecurityContext sc = new SecurityContext();
sc._disableFlow = this._disableFlow;
#if !FEATURE_PAL && FEATURE_IMPERSONATION
if (this.WindowsIdentity != null)
sc._windowsIdentity = new WindowsIdentity(this.WindowsIdentity.AccessToken);
#endif //!FEATURE_PAL && FEATURE_IMPERSONATION
//
if (this._compressedStack != null)
sc._compressedStack = this._compressedStack.CreateCopy();
return sc;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:19,代码来源:securitycontext.cs
示例20: Run
public static void Run(SecurityContext securityContext, ContextCallback callback, object state)
{
throw new NotSupportedException();
}
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:SecurityContext.cs
注:本文中的System.Security.SecurityContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论