Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / SamlSubjectStatement.cs / 1 / SamlSubjectStatement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Collections.Generic; using System.Collections.ObjectModel; using System.IdentityModel.Claims; using System.IdentityModel.Policy; using System.IdentityModel.Selectors; using System.Security.Principal; public abstract class SamlSubjectStatement : SamlStatement { SamlSubject subject; IAuthorizationPolicy policy; bool isReadOnly = false; protected SamlSubjectStatement() { } protected SamlSubjectStatement(SamlSubject samlSubject) { if (samlSubject == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSubject")); this.subject = samlSubject; } public SamlSubject SamlSubject { get {return this.subject; } set { if (isReadOnly) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly))); if (value == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("value")); this.subject = value; } } public override bool IsReadOnly { get { return this.isReadOnly; } } public override void MakeReadOnly() { if (!this.isReadOnly) { subject.MakeReadOnly(); this.isReadOnly = true; } } public override IAuthorizationPolicy CreatePolicy(ClaimSet issuer, SamlSecurityTokenAuthenticator samlAuthenticator) { if (issuer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuer"); // SupportingTokenAuthenticator collection can be null when the Subject does not // contain a key. if (this.policy == null) { ListclaimSets = new List (); ClaimSet subjectKeyClaimset = this.subject.ExtractSubjectKeyClaimSet(samlAuthenticator); if (subjectKeyClaimset != null) claimSets.Add(subjectKeyClaimset); List claims = new List (); ReadOnlyCollection subjectClaims = this.subject.ExtractClaims(); for (int i = 0; i < subjectClaims.Count; ++i) { claims.Add(subjectClaims[i]); } AddClaimsToList(claims); claimSets.Add(new DefaultClaimSet(issuer, claims)); this.policy = new UnconditionalPolicy(this.subject.Identity, claimSets.AsReadOnly(), SecurityUtils.MaxUtcDateTime); } return this.policy; } protected void SetSubject(SamlSubject samlSubject) { if (samlSubject == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSubject")); this.subject = samlSubject; } protected abstract void AddClaimsToList(IList claims); } } // 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
- Floater.cs
- TrimSurroundingWhitespaceAttribute.cs
- MediaSystem.cs
- SubMenuStyle.cs
- OdbcDataReader.cs
- MissingSatelliteAssemblyException.cs
- Solver.cs
- HtmlTableRowCollection.cs
- BamlBinaryReader.cs
- ChildTable.cs
- CompositeCollection.cs
- StorageEntitySetMapping.cs
- AlgoModule.cs
- TeredoHelper.cs
- HostedElements.cs
- RefreshResponseInfo.cs
- TextBoxLine.cs
- SqlInternalConnection.cs
- TraceContext.cs
- FileCodeGroup.cs
- Section.cs
- RenderContext.cs
- DataSvcMapFile.cs
- MultipartContentParser.cs
- FileChangeNotifier.cs
- ResourceWriter.cs
- ADRoleFactoryConfiguration.cs
- OutputCacheProfile.cs
- PeerCredentialElement.cs
- PropertyChangeTracker.cs
- OdbcConnectionStringbuilder.cs
- XmlSchemaRedefine.cs
- CodeGotoStatement.cs
- TextElement.cs
- AdRotatorDesigner.cs
- CompositeCollection.cs
- SectionInput.cs
- ManualResetEvent.cs
- TraceListeners.cs
- PropertyMap.cs
- CryptoKeySecurity.cs
- TransportBindingElementImporter.cs
- UdpDiscoveryEndpointProvider.cs
- RegionIterator.cs
- VBCodeProvider.cs
- Page.cs
- CompilerInfo.cs
- DataGridViewSelectedRowCollection.cs
- DeflateStream.cs
- SeparatorAutomationPeer.cs
- IpcClientManager.cs
- BamlResourceSerializer.cs
- ScrollChrome.cs
- ChangePasswordAutoFormat.cs
- UdpTransportSettingsElement.cs
- ProfileSettingsCollection.cs
- InfoCardListRequest.cs
- SR.Designer.cs
- SettingsPropertyCollection.cs
- metadatamappinghashervisitor.cs
- PageHandlerFactory.cs
- JoinQueryOperator.cs
- NumericUpDownAcceleration.cs
- PrePostDescendentsWalker.cs
- DataGridViewHitTestInfo.cs
- MetaType.cs
- OperationSelectorBehavior.cs
- DbParameterHelper.cs
- DataRowIndexBuffer.cs
- XmlCodeExporter.cs
- PrintingPermissionAttribute.cs
- EntityContainerAssociationSet.cs
- WinEventWrap.cs
- SiteMapHierarchicalDataSourceView.cs
- InternalResources.cs
- ApplicationCommands.cs
- ECDsa.cs
- AutomationPropertyChangedEventArgs.cs
- RuleSetBrowserDialog.cs
- MouseGesture.cs
- InvalidProgramException.cs
- SqlServer2KCompatibilityAnnotation.cs
- CodeMemberMethod.cs
- GeneralTransform2DTo3DTo2D.cs
- DiscoveryProxy.cs
- DesignerActionList.cs
- LogStore.cs
- FontStretch.cs
- ResetableIterator.cs
- PolyQuadraticBezierSegment.cs
- EditBehavior.cs
- SchemaExporter.cs
- LingerOption.cs
- FileDetails.cs
- FragmentQueryKB.cs
- AppDomainCompilerProxy.cs
- JsonQNameDataContract.cs
- SoapEnvelopeProcessingElement.cs
- BindableTemplateBuilder.cs
- NamespaceInfo.cs