You must Sign In to post a response.
  • Category: Webservices

    Binary Security Token Values Null

    Hi,

    While running the below code, I am getting null values for 'tok'. Perhaps thats the reason for "User Not Authenticated' error. Pls help.

    My code is almost same as in http://msdn.microsoft.com/en-us/library/ms827738.aspx

    public override void SecureMessage(SoapEnvelope envelope, Security security)
    {
    BinaryToken tok = new BinaryToken("User1|pass1");
    }

    private LifeTime _lifeTime = null;
    private EncryptedKey _encryptedKey = null;
    private RequestedProofToken _proofToken = null;
    private SymmetricKeyAlgorithm _key = null;
    RawData = (new UTF8Encoding()).GetBytes("User1|pass1");


    see below two sets of values 1. from UserNameToken and 2. from BinaryToken


    - tok {Microsoft.Web.Services3.Security.Tokens.UsernameToken} Microsoft.Web.Services3.Security.Tokens.UsernameToken
    + base {Microsoft.Web.Services3.Security.Tokens.UsernameToken} Microsoft.Web.Services3.Security.Tokens.SecurityToken {Microsoft.Web.Services3.Security.Tokens.UsernameToken}
    + AnyElements {Microsoft.Web.Services3.Xml.ElementList} Microsoft.Web.Services3.Xml.ElementList
    + Created {1/8/2015 9:11:20 AM} System.DateTime
    + Identity {System.Security.Principal.GenericIdentity} System.Security.Principal.IIdentity {System.Security.Principal.GenericIdentity}
    IsCurrent true bool
    IsExpired false bool
    + Key {Microsoft.Web.Services3.Security.Cryptography.AES256} Microsoft.Web.Services3.Security.Cryptography.KeyAlgorithm {Microsoft.Web.Services3.Security.Cryptography.AES256}
    + KeyBytes {byte[32]} byte[]
    Label "WS-Security" string
    + Nonce {byte[16]} byte[]
    Password "pass1" string
    PasswordDigest null byte[]
    PasswordOption SendPlainText Microsoft.Web.Services3.Security.Tokens.PasswordOption
    SupportsDataEncryption true bool
    SupportsDigitalSignature true bool
    Username "User1" string
    + Non-Public members


    - tok {TestProj.BinaryToken} TestProj.BinaryToken
    + base {TestProj.BinaryToken} Microsoft.Web.Services3.Security.Tokens.BinarySecurityToken {TestProj.BinaryToken}
    _encryptedKey null Microsoft.Web.Services3.Security.EncryptedKey
    _key null Microsoft.Web.Services3.Security.Cryptography.SymmetricKeyAlgorithm
    _lifeTime null Microsoft.Web.Services3.Security.LifeTime
    _proofToken null Microsoft.Web.Services3.Security.RequestedProofToken
    AppliesTo null Microsoft.Web.Services3.Design.AppliesTo
    BaseToken null Microsoft.Web.Services3.Security.Tokens.SecurityToken
    IsCurrent true bool
    Key null Microsoft.Web.Services3.Security.Cryptography.KeyAlgorithm
    LifeTime null Microsoft.Web.Services3.Security.LifeTime
    ProofToken null Microsoft.Web.Services3.Security.RequestedProofToken
    SupportingTokens null Microsoft.Web.Services3.Security.Tokens.SecurityTokenCollection
    SupportsDataEncryption true bool
    SupportsDigitalSignature true bool
    TokenIssuer null Microsoft.Web.Services3.Addressing.EndpointReference
    + tok {TestProj.BinaryToken} TestProj.BinaryToken
  • #755694
    Any expertise on the forum to help me out?

  • #755695
    This is the expanded view on 'tok' variable. I realised it's not completely Null... but still the User is not getting Authenticated.. What are other areas I can look into for troubleshooting?
    + tok {AuthnTest.BinaryToken} AuthnTest.BinaryToken
    - tok {AuthnTest.BinaryToken} AuthnTest.BinaryToken
    - base {AuthnTest.BinaryToken} Microsoft.Web.Services3.Security.Tokens.BinarySecurityToken {AuthnTest.BinaryToken}
    - base {AuthnTest.BinaryToken} Microsoft.Web.Services3.Security.Tokens.SecurityToken {AuthnTest.BinaryToken}
    - AttachedReference {System.Security.Cryptography.Xml.KeyInfo} System.Security.Cryptography.Xml.KeyInfo
    Count 1 int
    Id null string
    - Non-Public members
    m_id null string
    - m_KeyInfoClauses Count = 1 System.Collections.ArrayList
    - [0] {Microsoft.Web.Services3.Security.SecurityTokenReference} object {Microsoft.Web.Services3.Security.SecurityTokenReference}
    base {Microsoft.Web.Services3.Security.SecurityTokenReference} System.Security.Cryptography.Xml.KeyInfoClause {Microsoft.Web.Services3.Security.SecurityTokenReference}
    AbsoluteReference null string
    - AnyAttributes {Microsoft.Web.Services3.Xml.AttributeList} Microsoft.Web.Services3.Xml.AttributeList
    Count 0 int
    IsFixedSize false bool
    IsReadOnly false bool
    IsSynchronized false bool
    SyncRoot {object} object
    - Non-Public members
    _document null System.Xml.XmlDocument
    + _innerList Count = 0 System.Collections.ArrayList
    - AnyElements {Microsoft.Web.Services3.Xml.ElementList} Microsoft.Web.Services3.Xml.ElementList
    Count 0 int
    IsFixedSize false bool
    IsReadOnly false bool
    IsSynchronized false bool
    SyncRoot {object} object
    - Non-Public members
    _document null System.Xml.XmlDocument
    - _innerList Count = 0 System.Collections.ArrayList
    - Raw View
    Capacity 0 int
    Count 0 int
    IsFixedSize false bool
    IsReadOnly false bool
    IsSynchronized false bool
    SyncRoot {object} object
    + Static members
    + Non-Public members
    Embedded null Microsoft.Web.Services3.Security.Embedded
    Id "STR-8bdd5260-66ad-47a2-b407-1ad2db0c52f2" string
    KeyIdentifier null Microsoft.Web.Services3.Security.KeyIdentifier
    Reference "SecurityToken-75493973-f50e-4336-92e7-b6b2d4529adc" string
    RelativeReference "SecurityToken-75493973-f50e-4336-92e7-b6b2d4529adc" string
    - Token {AuthnTest.BinaryToken} Microsoft.Web.Services3.Security.Tokens.SecurityToken {AuthnTest.BinaryToken}
    - [AuthnTest.BinaryToken] {AuthnTest.BinaryToken} AuthnTest.BinaryToken
    + base {AuthnTest.BinaryToken} Microsoft.Web.Services3.Security.Tokens.BinarySecurityToken {AuthnTest.BinaryToken}
    _encryptedKey null Microsoft.Web.Services3.Security.EncryptedKey
    _key null Microsoft.Web.Services3.Security.Cryptography.SymmetricKeyAlgorithm
    _lifeTime null Microsoft.Web.Services3.Security.LifeTime
    _proofToken null Microsoft.Web.Services3.Security.RequestedProofToken
    AppliesTo null Microsoft.Web.Services3.Design.AppliesTo
    BaseToken null Microsoft.Web.Services3.Security.Tokens.SecurityToken
    IsCurrent true bool
    Key null Microsoft.Web.Services3.Security.Cryptography.KeyAlgorithm
    LifeTime null Microsoft.Web.Services3.Security.LifeTime
    ProofToken null Microsoft.Web.Services3.Security.RequestedProofToken
    SupportingTokens null Microsoft.Web.Services3.Security.Tokens.SecurityTokenCollection
    SupportsDataEncryption true bool
    SupportsDigitalSignature true bool
    TokenIssuer null Microsoft.Web.Services3.Addressing.EndpointReference
    - AttachedReference {System.Security.Cryptography.Xml.KeyInfo} System.Security.Cryptography.Xml.KeyInfo
    Count 1 int
    Id null string
    + Non-Public members
    Id "SecurityToken-75493973-f50e-4336-92e7-b6b2d4529adc" string
    Identity null System.Security.Principal.IIdentity
    IsCurrent true bool
    IsExpired false bool
    Key null Microsoft.Web.Services3.Security.Cryptography.KeyAlgorithm
    KeyIdentifier null Microsoft.Web.Services3.Security.KeyIdentifier
    Principal null System.Security.Principal.IPrincipal
    RequiresRenewal false bool
    SupportsDataEncryption true bool
    SupportsDigitalSignature true bool
    TokenType "binary" string
    UnattachedReference null System.Security.Cryptography.Xml.KeyInfo
    + Non-Public members
    ValueType "binary" string
    + Non-Public members
    + Raw View
    Id "SecurityToken-75493973-f50e-4336-92e7-b6b2d4529adc" string
    Identity null System.Security.Principal.IIdentity
    IsCurrent true bool
    IsExpired false bool
    Key null Microsoft.Web.Services3.Security.Cryptography.KeyAlgorithm
    KeyIdentifier null Microsoft.Web.Services3.Security.KeyIdentifier
    Principal null System.Security.Principal.IPrincipal
    RequiresRenewal false bool
    SupportsDataEncryption true bool
    SupportsDigitalSignature true bool
    TokenType "binary" string
    UnattachedReference null System.Security.Cryptography.Xml.KeyInfo
    + Non-Public members
    EncodingType "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" string
    + RawData {byte[20]} byte[]
    ValueType "binary" string
    + Non-Public members
    _encryptedKey null Microsoft.Web.Services3.Security.EncryptedKey
    _key null Microsoft.Web.Services3.Security.Cryptography.SymmetricKeyAlgorithm
    _lifeTime null Microsoft.Web.Services3.Security.LifeTime
    _proofToken null Microsoft.Web.Services3.Security.RequestedProofToken
    AppliesTo null Microsoft.Web.Services3.Design.AppliesTo
    BaseToken null Microsoft.Web.Services3.Security.Tokens.SecurityToken
    IsCurrent true bool
    Key null Microsoft.Web.Services3.Security.Cryptography.KeyAlgorithm
    LifeTime null Microsoft.Web.Services3.Security.LifeTime
    ProofToken null Microsoft.Web.Services3.Security.RequestedProofToken
    SupportingTokens null Microsoft.Web.Services3.Security.Tokens.SecurityTokenCollection
    SupportsDataEncryption true bool
    SupportsDigitalSignature true bool
    TokenIssuer null Microsoft.Web.Services3.Addressing.EndpointReference


  • Sign In to post your comments