Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / SamlSubjectStatement.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SwitchAttribute.cs
- ZoneLinkButton.cs
- GradientStop.cs
- WindowsSpinner.cs
- TextAction.cs
- StringValidatorAttribute.cs
- MailMessageEventArgs.cs
- PermissionSetTriple.cs
- FileInfo.cs
- sqlstateclientmanager.cs
- SystemParameters.cs
- DocComment.cs
- DbConnectionStringBuilder.cs
- PropertyState.cs
- DependencyObjectPropertyDescriptor.cs
- TrackingLocation.cs
- DataServiceClientException.cs
- MenuCommand.cs
- StylusButtonEventArgs.cs
- DataGridRowDetailsEventArgs.cs
- InternalBufferOverflowException.cs
- ArrangedElement.cs
- VisualTreeUtils.cs
- AutomationPatternInfo.cs
- DecoderFallbackWithFailureFlag.cs
- Zone.cs
- Boolean.cs
- CdpEqualityComparer.cs
- SimpleMailWebEventProvider.cs
- FunctionUpdateCommand.cs
- SmiContextFactory.cs
- IndentTextWriter.cs
- Condition.cs
- AVElementHelper.cs
- DocumentOrderComparer.cs
- TrackingStringDictionary.cs
- AutomationElement.cs
- Listbox.cs
- TextTreeFixupNode.cs
- DrawTreeNodeEventArgs.cs
- ArrangedElement.cs
- ISFTagAndGuidCache.cs
- RequestResizeEvent.cs
- LambdaCompiler.cs
- Container.cs
- JsonServiceDocumentSerializer.cs
- SortDescriptionCollection.cs
- AutomationElement.cs
- SynchronizedInputAdaptor.cs
- DocumentXmlWriter.cs
- SiteMapNodeItemEventArgs.cs
- TypeDefinition.cs
- XPathPatternParser.cs
- LassoHelper.cs
- CommonBehaviorsSection.cs
- DownloadProgressEventArgs.cs
- WindowsProgressbar.cs
- ResourceReferenceKeyNotFoundException.cs
- SamlAuthorizationDecisionClaimResource.cs
- PenCursorManager.cs
- Validator.cs
- HtmlImage.cs
- Button.cs
- BuildDependencySet.cs
- XamlGridLengthSerializer.cs
- XmlComplianceUtil.cs
- PointLight.cs
- QuadTree.cs
- IPPacketInformation.cs
- TransactionScope.cs
- DecoderFallback.cs
- AppLevelCompilationSectionCache.cs
- SmiEventStream.cs
- ReplacementText.cs
- EncryptedType.cs
- OutputCache.cs
- FontNameEditor.cs
- DataServiceQuery.cs
- Matrix3DConverter.cs
- ProxyHwnd.cs
- QuarticEase.cs
- BrowsableAttribute.cs
- PersonalizableTypeEntry.cs
- xmlformatgeneratorstatics.cs
- Button.cs
- RightsDocument.cs
- CompiledScopeCriteria.cs
- KerberosTicketHashIdentifierClause.cs
- PenThread.cs
- DataSourceBooleanViewSchemaConverter.cs
- XamlDesignerSerializationManager.cs
- FileUtil.cs
- HTMLTextWriter.cs
- InstallerTypeAttribute.cs
- TimeoutHelper.cs
- MaskDesignerDialog.cs
- Transform.cs
- XpsDocumentEvent.cs
- PlanCompiler.cs
- TraceLevelStore.cs