SecureConversationServiceCredential.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / SecureConversationServiceCredential.cs / 1 / SecureConversationServiceCredential.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Security 
{
    using System.IdentityModel.Policy; 
    using System.ServiceModel; 
    using System.IdentityModel.Tokens;
    using System.Runtime.Serialization; 
    using System.Collections.ObjectModel;

    public sealed class SecureConversationServiceCredential
    { 
        static readonly SecurityStateEncoder defaultSecurityStateEncoder = new DataProtectionSecurityStateEncoder();
        SecurityStateEncoder securityStateEncoder; 
        Collection securityContextClaimTypes; 
        bool isReadOnly;
 
        internal SecureConversationServiceCredential()
        {
            this.securityStateEncoder = defaultSecurityStateEncoder;
            securityContextClaimTypes = new Collection(); 
            SamlAssertion.AddSamlClaimTypes(securityContextClaimTypes);
        } 
 
        internal SecureConversationServiceCredential(SecureConversationServiceCredential other)
        { 
            this.securityStateEncoder = other.securityStateEncoder;
            this.securityContextClaimTypes = new Collection();
            for (int i = 0; i < other.securityContextClaimTypes.Count; ++i)
            { 
                this.securityContextClaimTypes.Add(other.securityContextClaimTypes[i]);
            } 
            this.isReadOnly = other.isReadOnly; 
        }
 
        public SecurityStateEncoder SecurityStateEncoder
        {
            get
            { 
                return this.securityStateEncoder;
            } 
            set 
            {
                ThrowIfImmutable(); 
                this.securityStateEncoder = value;
            }
        }
 
        public Collection SecurityContextClaimTypes
        { 
            get { return this.securityContextClaimTypes; } 
        }
 
        internal void MakeReadOnly()
        {
            this.isReadOnly = true;
        } 

        void ThrowIfImmutable() 
        { 
            if (this.isReadOnly)
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly)));
            }
        }
     } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK