Table of Contents

Class AccessKey

Namespace
Codebelt.SharedKernel.Security
Assembly
Codebelt.SharedKernel.dll

Represents an AccessKey object that can be used for API key-based authentication and similar.

public class AccessKey : ValueObject, IEquatable<ValueObject>, IEquatable<AccessKey>
Inheritance
Object
AccessKey
Implements
IEquatable<ValueObject>
IEquatable<AccessKey>
Inherited Members
ValueObject.PrintMembers(StringBuilder)
ValueObject.Equals(Object)
ValueObject.<Clone>$()
ValueObject.EqualityContract
Extension Methods

Remarks

Constructors

AccessKey(Secret, Action<AccessKeyOptions>)

Initializes a new instance of the AccessKey class.

public AccessKey(Secret secret, Action<AccessKeyOptions> setup = null)

Parameters

secret Secret

The Secret of the access key.

setup Action<AccessKeyOptions>

The AccessKeyOptions which may be configured.

Exceptions

System.ArgumentException

setup failed to configure an instance of AccessKeyOptions in a valid state.

Properties

DesiredTolerance

Gets the desired tolerance for potential clock skew variations.

public TimeSpan DesiredTolerance { get; }

Property Value

TimeSpan

The desired tolerance for potential clock skew variations.

Expires

Gets the expiry date and time of the access key expressed as Coordinated Universal Time (UTC).

public DateTime Expires { get; }

Property Value

DateTime

The expiry date and time of the access key expressed as Coordinated Universal Time (UTC).

Secret

Gets the secret of the access key.

public string Secret { get; }

Property Value

String

The secret of the access key.

ValidFrom

Gets the date and time,expressed as Coordinated Universal Time (UTC), from which the access key is valid.

public DateTime ValidFrom { get; }

Property Value

DateTime

The date and time, expressed as Coordinated Universal Time (UTC), from which the access key is valid.

Methods

Issue(Secret, TimeToLive)

Issues a new instance of AccessKey with an optional lifespan.

public static AccessKey Issue(Secret secret, TimeToLive lifespan = null)

Parameters

secret Secret

The secret used to generate the access key.

lifespan TimeToLive

The lifespan of the AccessKey. If null, the access key will not expire.

Returns

AccessKey

Returns a new AccessKey> instance with the specified secret and lifespan.

See Also