TokenDescriptor.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 / infocard / Service / managed / Microsoft / InfoCards / TokenDescriptor.cs / 1 / TokenDescriptor.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{ 
    using System;
    using System.Collections.Generic; 
    using System.Collections.ObjectModel; 
    using System.Security.Cryptography;
    using System.IdentityModel.Tokens; 
    using System.ServiceModel.Security.Tokens;
    using System.Xml;
    using System.IO;
 
    internal class TokenDescriptor : IDisposable
    { 
 
        string m_tokenId;
        DateTime m_effectiveTime; 
        DateTime m_expirationTime;
        XmlElement m_protectedToken;
        DisplayToken m_displayToken;
        SymmetricAlgorithm m_symmetricProof; 
        string m_internalTokenReference;
        string m_externalTokenReference; 
        List   m_disclosedClaims; 
        bool m_disposed;
        object m_sync; 


        public TokenDescriptor(
                    string tokenId, 
                    DateTime effectiveTime,
                    DateTime expirationTime, 
                    XmlElement protectedToken, 
                    DisplayToken displayToken,
                    SymmetricAlgorithm symmetricProof, 
                    string internalTokenReference,
                    string externalTokenReference,
                    IEnumerable disclosedClaims
                    ) 
        {
            m_sync = new object(); 
            m_tokenId = tokenId; 
            m_effectiveTime = effectiveTime;
            m_expirationTime = expirationTime; 
            m_protectedToken = protectedToken;
            m_displayToken = displayToken;
            m_symmetricProof = symmetricProof;
            m_internalTokenReference = internalTokenReference; 
            m_externalTokenReference = externalTokenReference;
            m_disclosedClaims = new List( disclosedClaims ); 
        } 

        public ReadOnlyCollection DisclosedClaims 
        {
            get { return m_disclosedClaims.AsReadOnly(); }
        }
 
        public string TokenId
        { 
            get { return m_tokenId; } 
        }
        public DateTime EffectiveTime 
        {
            get { return m_effectiveTime; }
        }
        public DateTime ExpirationTime 
        {
            get { return m_expirationTime; } 
        } 

        public string InternalTokenReference 
        {
            get{ return m_internalTokenReference; }

        } 

        public string ExternalTokenReference 
        { 
            get{ return m_externalTokenReference; }
        } 

        public XmlElement ProtectedToken
        {
            get { return m_protectedToken; } 
        }
 
        public DisplayToken DisplayToken 
        {
            get { return m_displayToken; } 
        }

        public SymmetricAlgorithm SymmetricProof
        { 
            get { return m_symmetricProof; }
        } 
 
        public void Write( BinaryWriter bwriter )
        { 
            bwriter.Write( m_effectiveTime.ToFileTimeUtc() );
            bwriter.Write( m_expirationTime.ToFileTimeUtc() );
            Utility.SerializeString( bwriter, m_protectedToken.OuterXml );
            Utility.SerializeString( bwriter, m_internalTokenReference ); 
            Utility.SerializeString( bwriter, m_externalTokenReference );
        } 
 

        public void Dispose() 
        {
            if ( !m_disposed )
            {
                lock ( m_sync ) 
                {
                    if ( !m_disposed ) 
                    { 
                        m_disposed = true;
 
                        if ( null != m_symmetricProof )
                        {
                            ( ( IDisposable )m_symmetricProof ).Dispose();
                            m_symmetricProof = null; 
                        }
 
                        m_protectedToken = null; 
                        m_expirationTime = DateTime.MinValue;
                        m_effectiveTime = DateTime.MinValue; 
                        m_tokenId = null;
                        m_externalTokenReference = null;
                        m_internalTokenReference = null;
                        m_disclosedClaims = null; 
                        m_displayToken = null;
                    } 
                } 
            }
        } 

    }
}

// 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