コード例 #1
0
        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 );
        }
コード例 #2
0
        internal SecurityTokenProvider( Info info )
        {
            if ( info == null )
                throw new ArgumentNullException( "info" );

            _info = info;
        }
コード例 #3
0
        internal ClientCredentials( Info info )
        {
            if ( info == null )
                throw new ArgumentNullException( "info" );

            _info = info;
        }
コード例 #4
0
ファイル: SecurityToken.cs プロジェクト: Sn3b/Omniture-API
        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>() );
        }
コード例 #5
0
ファイル: SecurityToken.cs プロジェクト: Sn3b/Omniture-API
 internal SecurityToken( Info usernameInfo )
     : this(usernameInfo, null, null)
 {
 }