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
118 lines
4.1 KiB
C#
118 lines
4.1 KiB
C#
//-----------------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
namespace System.ServiceModel.Security.Tokens
|
|
{
|
|
using System.IdentityModel.Selectors;
|
|
using System.ServiceModel.Channels;
|
|
using System.ServiceModel;
|
|
using System.IdentityModel.Tokens;
|
|
using System.ServiceModel.Security;
|
|
using System.Text;
|
|
using System.Globalization;
|
|
|
|
public class SspiSecurityTokenParameters : SecurityTokenParameters
|
|
{
|
|
internal const bool defaultRequireCancellation = false;
|
|
|
|
bool requireCancellation = defaultRequireCancellation;
|
|
BindingContext issuerBindingContext;
|
|
|
|
|
|
protected SspiSecurityTokenParameters(SspiSecurityTokenParameters other)
|
|
: base(other)
|
|
{
|
|
this.requireCancellation = other.requireCancellation;
|
|
if (other.issuerBindingContext != null)
|
|
{
|
|
this.issuerBindingContext = other.issuerBindingContext.Clone();
|
|
}
|
|
}
|
|
|
|
|
|
public SspiSecurityTokenParameters()
|
|
: this(defaultRequireCancellation)
|
|
{
|
|
// empty
|
|
}
|
|
|
|
public SspiSecurityTokenParameters(bool requireCancellation)
|
|
: base()
|
|
{
|
|
this.requireCancellation = requireCancellation;
|
|
}
|
|
|
|
internal protected override bool HasAsymmetricKey { get { return false; } }
|
|
|
|
public bool RequireCancellation
|
|
{
|
|
get
|
|
{
|
|
return this.requireCancellation;
|
|
}
|
|
set
|
|
{
|
|
this.requireCancellation = value;
|
|
}
|
|
}
|
|
|
|
internal BindingContext IssuerBindingContext
|
|
{
|
|
get
|
|
{
|
|
return this.issuerBindingContext;
|
|
}
|
|
set
|
|
{
|
|
if (value != null)
|
|
{
|
|
value = value.Clone();
|
|
}
|
|
this.issuerBindingContext = value;
|
|
}
|
|
}
|
|
|
|
internal protected override bool SupportsClientAuthentication { get { return true; } }
|
|
internal protected override bool SupportsServerAuthentication { get { return true; } }
|
|
internal protected override bool SupportsClientWindowsIdentity { get { return true; } }
|
|
|
|
protected override SecurityTokenParameters CloneCore()
|
|
{
|
|
return new SspiSecurityTokenParameters(this);
|
|
}
|
|
|
|
internal protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
|
|
{
|
|
if (token is GenericXmlSecurityToken)
|
|
return base.CreateGenericXmlTokenKeyIdentifierClause(token, referenceStyle);
|
|
else
|
|
return this.CreateKeyIdentifierClause<SecurityContextKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
|
|
}
|
|
|
|
protected internal override void InitializeSecurityTokenRequirement(SecurityTokenRequirement requirement)
|
|
{
|
|
requirement.TokenType = ServiceModelSecurityTokenTypes.Spnego;
|
|
requirement.RequireCryptographicToken = true;
|
|
requirement.KeyType = SecurityKeyType.SymmetricKey;
|
|
requirement.Properties[ServiceModelSecurityTokenRequirement.SupportSecurityContextCancellationProperty] = this.RequireCancellation;
|
|
if (this.IssuerBindingContext != null)
|
|
{
|
|
requirement.Properties[ServiceModelSecurityTokenRequirement.IssuerBindingContextProperty] = this.IssuerBindingContext.Clone();
|
|
}
|
|
requirement.Properties[ServiceModelSecurityTokenRequirement.IssuedSecurityTokenParametersProperty] = this.Clone();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine(base.ToString());
|
|
|
|
sb.Append(String.Format(CultureInfo.InvariantCulture, "RequireCancellation: {0}", this.RequireCancellation.ToString()));
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|