mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
//-----------------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
namespace System.ServiceModel.Security.Tokens
|
|
{
|
|
using System;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Runtime.CompilerServices;
|
|
using System.IdentityModel.Selectors;
|
|
using System.IdentityModel.Tokens;
|
|
|
|
class SecurityTokenProviderContainer
|
|
{
|
|
SecurityTokenProvider tokenProvider;
|
|
|
|
public SecurityTokenProviderContainer(SecurityTokenProvider tokenProvider)
|
|
{
|
|
if (tokenProvider == null)
|
|
{
|
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenProvider");
|
|
}
|
|
this.tokenProvider = tokenProvider;
|
|
}
|
|
|
|
public SecurityTokenProvider TokenProvider
|
|
{
|
|
get { return this.tokenProvider; }
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public void Close(TimeSpan timeout)
|
|
{
|
|
SecurityUtils.CloseTokenProviderIfRequired(this.tokenProvider, timeout);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public void Open(TimeSpan timeout)
|
|
{
|
|
SecurityUtils.OpenTokenProviderIfRequired(this.tokenProvider, timeout);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public void Abort()
|
|
{
|
|
SecurityUtils.AbortTokenProviderIfRequired(this.tokenProvider);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public X509Certificate2 GetCertificate(TimeSpan timeout)
|
|
{
|
|
X509SecurityToken token = this.tokenProvider.GetToken(timeout) as X509SecurityToken;
|
|
if (token != null)
|
|
{
|
|
return token.Certificate;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|