Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / Tokens / SspiSecurityToken.cs / 1 / SspiSecurityToken.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Security.Tokens
{
using System.IdentityModel.Claims;
using System.ServiceModel;
using System.IdentityModel.Policy;
using System.IdentityModel.Tokens;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Security.Principal;
using System.Net;
public class SspiSecurityToken : SecurityToken
{
string id;
TokenImpersonationLevel impersonationLevel;
bool allowNtlm;
NetworkCredential networkCredential;
bool extractGroupsForWindowsAccounts;
bool allowUnauthenticatedCallers = SspiSecurityTokenProvider.DefaultAllowUnauthenticatedCallers;
DateTime effectiveTime;
DateTime expirationTime;
public SspiSecurityToken(TokenImpersonationLevel impersonationLevel, bool allowNtlm, NetworkCredential networkCredential)
{
this.impersonationLevel = impersonationLevel;
this.allowNtlm = allowNtlm;
this.networkCredential = SecurityUtils.GetNetworkCredentialsCopy(networkCredential);
this.effectiveTime = DateTime.UtcNow;
this.expirationTime = this.effectiveTime.AddHours(10);
}
public SspiSecurityToken(NetworkCredential networkCredential, bool extractGroupsForWindowsAccounts, bool allowUnauthenticatedCallers)
{
this.networkCredential = SecurityUtils.GetNetworkCredentialsCopy(networkCredential);
this.extractGroupsForWindowsAccounts = extractGroupsForWindowsAccounts;
this.allowUnauthenticatedCallers = allowUnauthenticatedCallers;
this.effectiveTime = DateTime.UtcNow;
this.expirationTime = this.effectiveTime.AddHours(10);
}
public override string Id
{
get
{
if (this.id == null)
this.id = SecurityUniqueId.Create().Value;
return this.id;
}
}
public override DateTime ValidFrom
{
get { return this.effectiveTime; }
}
public override DateTime ValidTo
{
get { return this.expirationTime; }
}
public bool AllowUnauthenticatedCallers
{
get
{
return this.allowUnauthenticatedCallers;
}
}
public TokenImpersonationLevel ImpersonationLevel
{
get
{
return this.impersonationLevel;
}
}
public bool AllowNtlm
{
get
{
return this.allowNtlm;
}
}
public NetworkCredential NetworkCredential
{
get
{
return this.networkCredential;
}
}
public bool ExtractGroupsForWindowsAccounts
{
get
{
return this.extractGroupsForWindowsAccounts;
}
}
public override ReadOnlyCollection SecurityKeys
{
get
{
return EmptyReadOnlyCollection.Instance;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewAdvancedBorderStyle.cs
- ElementHost.cs
- IisTraceListener.cs
- OdbcConnectionString.cs
- OdbcErrorCollection.cs
- XmlSchemaRedefine.cs
- SerializerProvider.cs
- FilterableAttribute.cs
- RelativeSource.cs
- LinearKeyFrames.cs
- EnvironmentPermission.cs
- COM2ICategorizePropertiesHandler.cs
- AggregatePushdown.cs
- TextDecorations.cs
- WindowsImpersonationContext.cs
- FontSizeConverter.cs
- HtmlTableRow.cs
- FunctionNode.cs
- EventTrigger.cs
- Geometry.cs
- ExpressionCopier.cs
- HtmlInputSubmit.cs
- TransformerInfoCollection.cs
- SqlNotificationRequest.cs
- WebHostScriptMappingsInstallComponent.cs
- ReaderContextStackData.cs
- sqlpipe.cs
- StdValidatorsAndConverters.cs
- SID.cs
- GridEntryCollection.cs
- HtmlHead.cs
- EditCommandColumn.cs
- BroadcastEventHelper.cs
- CorrelationToken.cs
- TraceHwndHost.cs
- WorkflowDefinitionContext.cs
- Cloud.cs
- _CommandStream.cs
- SelectionChangedEventArgs.cs
- FormViewUpdateEventArgs.cs
- XmlFormatExtensionPointAttribute.cs
- BinaryNode.cs
- EdmTypeAttribute.cs
- ServiceOperation.cs
- XmlChoiceIdentifierAttribute.cs
- AccessViolationException.cs
- WindowsAuthenticationModule.cs
- TransactionScope.cs
- ToolStripArrowRenderEventArgs.cs
- TimeIntervalCollection.cs
- BufferModesCollection.cs
- SynchronizedDispatch.cs
- VerticalAlignConverter.cs
- ClientRuntimeConfig.cs
- RelatedView.cs
- GridItem.cs
- ImageInfo.cs
- PocoPropertyAccessorStrategy.cs
- TableRowGroup.cs
- ConstructorNeedsTagAttribute.cs
- WebPartConnectionsCancelVerb.cs
- CharacterHit.cs
- XmlAnyElementAttribute.cs
- RegexCompiler.cs
- DependencyObjectPropertyDescriptor.cs
- PrtCap_Public_Simple.cs
- CodeBlockBuilder.cs
- CompilerHelpers.cs
- DmlSqlGenerator.cs
- KerberosSecurityTokenAuthenticator.cs
- WarningException.cs
- Stopwatch.cs
- Point.cs
- MulticastNotSupportedException.cs
- PtsPage.cs
- QueryContinueDragEventArgs.cs
- PersonalizationAdministration.cs
- TreeViewImageIndexConverter.cs
- HandleCollector.cs
- TimelineClockCollection.cs
- QfeChecker.cs
- CultureNotFoundException.cs
- XslTransform.cs
- _DigestClient.cs
- QilInvoke.cs
- ArrayConverter.cs
- ImageSourceConverter.cs
- CommandExpr.cs
- _StreamFramer.cs
- PrintController.cs
- NewArrayExpression.cs
- Win32Native.cs
- KnownBoxes.cs
- IdentityModelDictionary.cs
- DataSetUtil.cs
- DataServiceConfiguration.cs
- ChtmlFormAdapter.cs
- HttpListenerPrefixCollection.cs
- FloaterParagraph.cs
- TableFieldsEditor.cs