Class UserNamePasswordHashIdentityDefinition
Represents serializable user name and hashed password credentials.
Inherited Members
Namespace: Nevatech.Vsb.Repository.Services.Identities
Assembly: Nevatech.Vsb.Repository.dll
Syntax
[DataContract(Namespace = "http://schemas.nevatech.com/sentinet/2011/02")]
public sealed class UserNamePasswordHashIdentityDefinition : IdentityDefinitionBase, IValidator, IExtensibleDataObject
Constructors
UserNamePasswordHashIdentityDefinition()
Initializes an empty instance.
Declaration
public UserNamePasswordHashIdentityDefinition()
UserNamePasswordHashIdentityDefinition(Identity)
Initializes new instance from provided Identity object.
Declaration
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
public UserNamePasswordHashIdentityDefinition(Identity identity)
Parameters
| Type | Name | Description |
|---|---|---|
| Identity | identity | Identity object used to populate new instance. |
UserNamePasswordHashIdentityDefinition(string, byte[])
Initializes new instance from provided user name and password hash.
Declaration
public UserNamePasswordHashIdentityDefinition(string userName, byte[] passwordHash)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userName | User name associated with the credentials. |
| byte[] | passwordHash | Password hash for the user name associated with the credentials. |
UserNamePasswordHashIdentityDefinition(string, string)
Initializes new instance from provided user name and clear-text password.
Declaration
public UserNamePasswordHashIdentityDefinition(string userName, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userName | User name associated with the credentials. |
| string | password | Password for the user name associated with the credentials. |
Properties
FriendlyName
Gets or sets the friendly name describing stored identity.
Declaration
[DataMember]
public override string FriendlyName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
Kind
Gets stored identity kind (like X.509 certificate, SPN, etc).
Declaration
[DataMember]
public override IdentityKind Kind { get; protected set; }
Property Value
| Type | Description |
|---|---|
| IdentityKind |
Overrides
PasswordHash
Gets the password hash for the user name associated with the credentials.
Declaration
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[DataMember]
public byte[] PasswordHash { get; set; }
Property Value
| Type | Description |
|---|---|
| byte[] |
Remarks
Hash is calculated using SHA1 algorithm with 4 bytes nonce which is prepended to the resulting value (hash = nonce + SHA1(password, nonce)).
UserName
Gets the user name associated with the credentials.
Declaration
[DataMember]
public string UserName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetIdentity()
Returns Identity object populated with the data stored in this instance.
Declaration
public override Identity GetIdentity()
Returns
| Type | Description |
|---|---|
| Identity | Identity object populated with the data stored in this instance. |
Overrides
Validate()
Validates this domain object's state.
Declaration
public override bool Validate()
Returns
| Type | Description |
|---|---|
| bool | True if object's state is valid; otherwise, false. |
Overrides
ValidatePassword(string)
Validates provided password with the hash value stored in this instance.
Declaration
public bool ValidatePassword(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | password | Password that needs to be validated. |
Returns
| Type | Description |
|---|---|
| bool | True, if provided password corresponds to the hash stored in this instance. False, otherwise. |