protected override System.IdentityModel.Tokens.SecurityToken ReadTokenCore( XmlReader reader, SecurityTokenResolver tokenResolver )
        {
            if ( reader == null )
                throw new ArgumentNullException( "reader" );

            if ( reader.IsStartElement( Constants.UsernameTokenName, Constants.UsernameTokenNamespace ) )
            {
                //string id = reader.GetAttribute( Constants.IdAttributeName, Constants.WsUtilityNamespace );

                reader.ReadStartElement();

                // read the user name
                string userName = reader.ReadElementString( Constants.UsernameElementName, Constants.UsernameTokenNamespace );

                // read the password hash
                string password = reader.ReadElementString( Constants.PasswordElementName, Constants.UsernameTokenNamespace );

                // read nonce
                string nonce = reader.ReadElementString( Constants.NonceElementName, Constants.UsernameTokenNamespace );

                // read created
                string created = reader.ReadElementString( Constants.CreatedElementName, Constants.WsUtilityNamespace );

                reader.ReadEndElement();

                var info = new Info( userName, password );

                return new SecurityToken( info, nonce, created );
            }

            return DefaultInstance.ReadToken( reader, tokenResolver );
        }
Esempio n. 2
0
        internal SecurityTokenProvider( Info info )
        {
            if ( info == null )
                throw new ArgumentNullException( "info" );

            _info = info;
        }
Esempio n. 3
0
        internal ClientCredentials( Info info )
        {
            if ( info == null )
                throw new ArgumentNullException( "info" );

            _info = info;
        }
Esempio n. 4
0
        internal SecurityToken( Info info, string nonce, string created )
        {
            if ( info == null )
                throw new ArgumentNullException( "info" );

            _info = info;

            if ( nonce != null )
            {
                _nonce = Convert.FromBase64String( nonce );
            }

            if ( created != null )
            {
                _created = DateTime.Parse( created );
            }

            // the user name token is not capable of any crypto
            _securityKeys = new ReadOnlyCollection<SecurityKey>( new List<SecurityKey>() );
        }
Esempio n. 5
0
 internal SecurityToken( Info usernameInfo )
     : this(usernameInfo, null, null)
 {
 }