Skip to content

Reference

OpcServerIdentity Members

Represents the identity of a user of the server, which is identified by a user name and a password.

Reference

OpcServerIdentity Members ​

Type
OpcServerIdentity
Namespace
Opc.UaFx.Server
Assembly
Opc.UaFx.Advanced.dll
Package
Opc.UaFx.Advanced v2.59.0

Inherits members from OpcUserIdentity, OpcIdentity.

Constructors ​

OpcServerIdentity ​

3 overloads

OverloadDescription
OpcServerIdentity(string)since v2.7Initializes a new instance of the OpcServerIdentity class using the userName specified and an empty password.
OpcServerIdentity(string, string)since v2.7Initializes a new instance of the OpcServerIdentity class using the userName and password specified.
OpcServerIdentity(string, byte[])Initializes a new instance of the OpcServerIdentity class using the userName and password specified.

Exceptions (all overloads)

ExceptionCondition
ArgumentExceptionThe userName is equals Empty.

OpcServerIdentity(string) ​

since v2.7

Initializes a new instance of the OpcServerIdentity class using the userName specified and an empty password.

csharp
public OpcServerIdentity(string userName)
vbnet
Public Sub New(userName As String)

Parameters

NameTypeDescription
userNameStringThe name of the user.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe userName is a null reference (Nothing in Visual Basic).

OpcServerIdentity(string, string) ​

since v2.7

Initializes a new instance of the OpcServerIdentity class using the userName and password specified.

csharp
public OpcServerIdentity(string userName, string password)
vbnet
Public Sub New(userName As String, password As String)

Parameters

NameTypeDescription
userNameStringThe name of the user.
passwordStringThe password of the user, which is stored as transformed by TransformPassword.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe userName or password is a null reference (Nothing in Visual Basic).

Remarks

The constructor calls the virtual method TransformPassword, so that an override in a derived class is called before the constructor of the derived class has initialized the instance.

OpcServerIdentity(string, byte[]) ​

Initializes a new instance of the OpcServerIdentity class using the userName and password specified.

csharp
public OpcServerIdentity(string userName, byte[] password)
vbnet
Public Sub New(userName As String, password As Byte())

Parameters

NameTypeDescription
userNameStringThe name of the user.
passwordByte[]The bytes of the password of the user, which need to equal the result of TransformPassword for the password a client provides; by default these are the bytes of the password encoded using UTF-16 (little endian).

Exceptions

ExceptionCondition
ArgumentNullExceptionThe userName or password is a null reference (Nothing in Visual Basic).

Remarks

The password is stored without being copied, so that later changes of the array change the password of the identity.

Properties ​

DisplayName ​

override

Gets the name displayed for the identity.

csharp
public override string DisplayName { get; }
vbnet
Public Overrides ReadOnly Property DisplayName As String

Property value

String

The UserName of the identity.

Overrides

DisplayName

UserName ​

Gets the name of the user.

csharp
public string UserName { get; }
vbnet
Public ReadOnly Property UserName As String

Property value

String

The user name specified on construction.

Methods ​

ChangePassword ​

2 overloads

OverloadDescription
ChangePassword(string)since v2.7Changes the password of the identity to the password specified.
ChangePassword(byte[])Changes the password of the identity to the bytes specified by password.

Exceptions (all overloads)

ExceptionCondition
ArgumentNullExceptionThe password is a null reference (Nothing in Visual Basic).

ChangePassword(string) ​

since v2.7

Changes the password of the identity to the password specified.

csharp
public void ChangePassword(string password)
vbnet
Public Sub ChangePassword(password As String)

Parameters

NameTypeDescription
passwordStringThe new password of the user, which is stored as transformed by TransformPassword.

ChangePassword(byte[]) ​

Changes the password of the identity to the bytes specified by password.

csharp
public void ChangePassword(byte[] password)
vbnet
Public Sub ChangePassword(password As Byte())

Parameters

NameTypeDescription
passwordByte[]The bytes of the new password of the user, which need to equal the result of TransformPassword for the password a client provides; by default these are the bytes of the password encoded using UTF-16 (little endian).

Remarks

The bytes are copied.

Impersonate ​

override

Returns an impersonation context for the identity.

csharp
public override OpcImpersonationContext Impersonate()
vbnet
Public Overrides Function Impersonate() As OpcImpersonationContext

Returns

OpcImpersonationContext

An instance of the OpcDefaultImpersonationContext class, which does not impersonate the user.

Overrides

Impersonate

Matches ​

virtual · since v2.7

Determines whether the userName and password specified match the identity.

csharp
public virtual bool Matches(string userName, string password)
vbnet
Public Overridable Function Matches(
    userName As String,
    password As String) As Boolean

Parameters

NameTypeDescription
userNameStringThe user name to compare.
passwordStringThe password to compare.

Returns

Boolean

The value true if the userName equals the UserName (case-sensitive) and the result of TransformPassword for the password equals the password of the identity; otherwise the value false.

Exceptions

ExceptionCondition
ArgumentExceptionThe userName is equals Empty.
ArgumentNullExceptionThe userName or password is a null reference (Nothing in Visual Basic).

Remarks

The passwords are compared in constant time.

TransformPassword ​

protected · virtual · since v2.7

Transforms the password specified into the bytes stored and compared by the identity.

csharp
protected virtual byte[] TransformPassword(string password)
vbnet
Protected Overridable Function TransformPassword(password As String) As Byte()

Parameters

NameTypeDescription
passwordStringThe password to transform.

Returns

Byte[]

The bytes of the password. The base implementation returns the password encoded using UTF-16 (little endian) (see Unicode).

Remarks

The method is also called by the constructor OpcServerIdentity.