public static Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor Convert(SecurityTokenDescriptor tokenDescriptor)
        {
            v1SecurityTokenDescriptor v1TokenDescriptor = new v1SecurityTokenDescriptor();

            if (tokenDescriptor.AppliesToAddress != null)
            {
                v1TokenDescriptor.AppliesToAddress = tokenDescriptor.AppliesToAddress;
            }

            if (tokenDescriptor.AttachedReference != null)
            {
                v1TokenDescriptor.AttachedReference = tokenDescriptor.AttachedReference;
            }

            if (tokenDescriptor.AuthenticationInfo != null)
            {
                v1TokenDescriptor.AuthenticationInfo = Convert(tokenDescriptor.AuthenticationInfo);
            }

            if (tokenDescriptor.Lifetime != null)
            {
                v1TokenDescriptor.Lifetime = new Microsoft.IdentityModel.Protocols.WSTrust.Lifetime(tokenDescriptor.Lifetime.Created, tokenDescriptor.Lifetime.Expires);
            }

            if (tokenDescriptor.ReplyToAddress != null)
            {
                v1TokenDescriptor.ReplyToAddress = tokenDescriptor.ReplyToAddress;
            }

            if (tokenDescriptor.SigningCredentials != null)
            {
                v1TokenDescriptor.SigningCredentials = tokenDescriptor.SigningCredentials;
            }

            if (tokenDescriptor.Subject != null)
            {
                v1TokenDescriptor.Subject = Convert(tokenDescriptor.Subject);
            }

            if (tokenDescriptor.TokenIssuerName != null)
            {
                v1TokenDescriptor.TokenIssuerName = tokenDescriptor.TokenIssuerName;
            }

            if (tokenDescriptor.TokenType != null)
            {
                v1TokenDescriptor.TokenType = tokenDescriptor.TokenType;
            }

            return(v1TokenDescriptor);
        }
        public static Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor Convert( SecurityTokenDescriptor tokenDescriptor )
        {
            v1SecurityTokenDescriptor v1TokenDescriptor = new v1SecurityTokenDescriptor();

            if ( tokenDescriptor.AppliesToAddress != null )
                v1TokenDescriptor.AppliesToAddress = tokenDescriptor.AppliesToAddress;

            if ( tokenDescriptor.AttachedReference != null )
                v1TokenDescriptor.AttachedReference = tokenDescriptor.AttachedReference;

            if ( tokenDescriptor.AuthenticationInfo != null )
                v1TokenDescriptor.AuthenticationInfo = Convert(tokenDescriptor.AuthenticationInfo);

            if ( tokenDescriptor.Lifetime != null )
                v1TokenDescriptor.Lifetime = new Microsoft.IdentityModel.Protocols.WSTrust.Lifetime( tokenDescriptor.Lifetime.Created, tokenDescriptor.Lifetime.Expires );

            if ( tokenDescriptor.ReplyToAddress != null )
                v1TokenDescriptor.ReplyToAddress = tokenDescriptor.ReplyToAddress;

            if ( tokenDescriptor.SigningCredentials != null )
                v1TokenDescriptor.SigningCredentials = tokenDescriptor.SigningCredentials;

            if ( tokenDescriptor.Subject != null )
                v1TokenDescriptor.Subject = Convert( tokenDescriptor.Subject );

            if ( tokenDescriptor.TokenIssuerName != null )
                v1TokenDescriptor.TokenIssuerName = tokenDescriptor.TokenIssuerName;

            if ( tokenDescriptor.TokenType != null )
                v1TokenDescriptor.TokenType = tokenDescriptor.TokenType;

            return v1TokenDescriptor;
        }