Opc.Ua.UserIdentity.Initialize C# (CSharp) Method

Initialize() private method

Initializes the object with a UA identity token
private Initialize ( UserIdentityToken token ) : void
token UserIdentityToken
return void
        private void Initialize(UserIdentityToken token)
        {
            if (token == null) throw new ArgumentNullException("token");

            m_policyId = token.PolicyId;
  
            UserNameIdentityToken usernameToken = token as UserNameIdentityToken;

            if (usernameToken != null)
            {
                Initialize(new UserNameSecurityToken(usernameToken.UserName, usernameToken.DecryptedPassword));
                return;
            }        
  
            X509IdentityToken x509Token = token as X509IdentityToken;

            if (x509Token != null)
            {
                X509Certificate2 certificate = CertificateFactory.Create(x509Token.CertificateData, true);  
                Initialize(new X509SecurityToken(certificate));
                return;
            }
   
            IssuedIdentityToken wssToken = token as IssuedIdentityToken;
            
            if (wssToken != null)
            {
                Initialize(wssToken, WSSecurityTokenSerializer.DefaultInstance, null);                
                return;
            }
            
            AnonymousIdentityToken anonymousToken = token as AnonymousIdentityToken;

            if (anonymousToken != null)
            {
                m_tokenType = UserTokenType.Anonymous;
                m_issuedTokenType = null;
                m_displayName = "Anonymous";
                m_token = null;
                return;
            }        
  
            throw new ArgumentException("Unrecognized UA user identity token type.", "token");
        }
        

Same methods

UserIdentity::Initialize ( CertificateIdentifier certificateId ) : void
UserIdentity::Initialize ( IssuedIdentityToken token, System.IdentityModel.Selectors.SecurityTokenSerializer serializer, System.IdentityModel.Selectors.SecurityTokenResolver resolver ) : void
UserIdentity::Initialize ( System.IdentityModel.Tokens.SecurityToken token ) : void
UserIdentity::Initialize ( X509Certificate2 certificate ) : void
UserIdentity::Initialize ( string username, string password ) : void