Class SecurityToken
Represents a simple security token schematic.
Inheritance
Namespace: Cuemon.Security
Assembly: Cuemon.Security.dll
Syntax
public sealed class SecurityToken
Properties
| Improve this DocHasExpired
Gets a value indicating whether this SecurityToken has expired.
Declaration
public bool HasExpired { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Settings
Gets the settings applied to this SecurityToken.
Declaration
public SecurityTokenSettings Settings { get; }
Property Value
Type | Description |
---|---|
SecurityTokenSettings | The settings applied to this SecurityToken. |
Token
Gets the token of this SecurityToken.
Declaration
public string Token { get; }
Property Value
Type | Description |
---|---|
System.String |
UtcCreated
Gets the UTC date time value from when this instance was created.
Declaration
public DateTime UtcCreated { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
Methods
| Improve this DocCreate(SecurityTokenSettings)
Creates and returns a new SecurityToken from the specified settings
.
Declaration
public static SecurityToken Create(SecurityTokenSettings settings)
Parameters
Type | Name | Description |
---|---|---|
SecurityTokenSettings | settings | The settings to apply to the SecurityToken instance. |
Returns
Type | Description |
---|---|
SecurityToken | A new SecurityToken instance. |
CreateSettings()
Specifies a set of features to apply on the SecurityToken object.
Declaration
public static SecurityTokenSettings CreateSettings()
Returns
Type | Description |
---|---|
SecurityTokenSettings | A SecurityTokenSettings instance that specifies a set of features to apply the SecurityToken object. |
Remarks
The following table shows the initial property values for an instance of SecurityTokenSettings.
Property | Initial Value |
---|---|
LengthOfToken | 24 |
Reference | Empty ("" ). |
TimeToLive | 15 seconds |
CreateSettings(TimeSpan)
Specifies a set of features to apply on the SecurityToken object.
Declaration
public static SecurityTokenSettings CreateSettings(TimeSpan timeToLive)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeToLive | The amount of time this token remains usable. |
Returns
Type | Description |
---|---|
SecurityTokenSettings | A SecurityTokenSettings instance that specifies a set of features to apply on the SecurityToken object. |
CreateSettings(TimeSpan, Int32)
Specifies a set of features to apply on the SecurityToken object.
Declaration
public static SecurityTokenSettings CreateSettings(TimeSpan timeToLive, int lengthOfToken)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeToLive | The amount of time this token remains usable. |
System.Int32 | lengthOfToken | The length of the random generated token. |
Returns
Type | Description |
---|---|
SecurityTokenSettings | A SecurityTokenSettings instance that specifies a set of features to apply on the SecurityToken object. |
CreateSettings(TimeSpan, Int32, String)
Specifies a set of features to apply on the SecurityToken object.
Declaration
public static SecurityTokenSettings CreateSettings(TimeSpan timeToLive, int lengthOfToken, string reference)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeToLive | The amount of time this token remains usable. |
System.Int32 | lengthOfToken | The length of the random generated token. |
System.String | reference | The reference of this token. |
Returns
Type | Description |
---|---|
SecurityTokenSettings | A SecurityTokenSettings instance that specifies a set of features to apply on the SecurityToken object. |
CreateSettings(TimeSpan, String)
Specifies a set of features to apply on the SecurityToken object.
Declaration
public static SecurityTokenSettings CreateSettings(TimeSpan timeToLive, string reference)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeToLive | The amount of time this token remains usable. |
System.String | reference | The reference of this token. |
Returns
Type | Description |
---|---|
SecurityTokenSettings | A SecurityTokenSettings instance that specifies a set of features to apply on the SecurityToken object. |
Equals(SecurityToken)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(SecurityToken other)
Parameters
Type | Name | Description |
---|---|---|
SecurityToken | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Parse(String)
Converts the System.String representation to its SecurityToken equivalent.
Declaration
public static SecurityToken Parse(string securityToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | securityToken | The SecurityToken equivalent created by ToString(). |
Returns
Type | Description |
---|---|
SecurityToken | A SecurityToken instance. |
ToString()
Returns a System.String that represents this instance in the following format: ttl;created;token;.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance in the following format: ttl;created;token;. |
Overrides
Operators
| Improve this DocEquality(SecurityToken, SecurityToken)
Indicates whether two SecurityToken instances are equal.
Declaration
public static bool operator ==(SecurityToken token1, SecurityToken token2)
Parameters
Type | Name | Description |
---|---|---|
SecurityToken | token1 | The first token to compare. |
SecurityToken | token2 | The second token to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Inequality(SecurityToken, SecurityToken)
Indicates whether two SecurityToken instances are not equal.
Declaration
public static bool operator !=(SecurityToken token1, SecurityToken token2)
Parameters
Type | Name | Description |
---|---|---|
SecurityToken | token1 | The first token to compare. |
SecurityToken | token2 | The second token to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|