Class SharedKeyService
Provides a service to authenticate requests using shared keys.
Inheritance
object
SharedKeyService
Implements
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DataWeb.Authorization
Assembly: DataWeb.Core.dll
Syntax
public class SharedKeyService : ISharedKeyService
Methods
GetHttpHeaders(Uri, string, string, string)
Generates a dictionary of HTTP headers for authenticating a request.
Declaration
public Dictionary<string, string> GetHttpHeaders(Uri url, string appName, string secretKey, string httpMethod)
Parameters
Type | Name | Description |
---|---|---|
Uri | url | |
string | appName | |
string | secretKey | |
string | httpMethod |
Returns
Type | Description |
---|---|
Dictionary<string, string> |
GetSignature(string, string)
Computes the signature of the provided data using the provided secret key.
Declaration
public string GetSignature(string data, string sectretKey)
Parameters
Type | Name | Description |
---|---|---|
string | data | |
string | sectretKey |
Returns
Type | Description |
---|---|
string |
GetStamp()
Retrieves the current Unix timestamp.
Declaration
public ulong GetStamp()
Returns
Type | Description |
---|---|
ulong |
IsValidRequest(string, string, string, ulong, string, string, string, ulong)
Validates if a request is valid based on the provided parameters.
Declaration
public bool IsValidRequest(string appName, string secretKey, string requestAppName, ulong requestStamp, string requestSignature, string requestUrl, string requestMethod, ulong seconds = 300)
Parameters
Type | Name | Description |
---|---|---|
string | appName | |
string | secretKey | |
string | requestAppName | |
ulong | requestStamp | |
string | requestSignature | |
string | requestUrl | |
string | requestMethod | |
ulong | seconds |
Returns
Type | Description |
---|---|
bool |
ValidateStamp(ulong, ulong)
Validates if the request timestamp is within the specified time range.
Declaration
public bool ValidateStamp(ulong requestStamp, ulong seconds)
Parameters
Type | Name | Description |
---|---|---|
ulong | requestStamp | |
ulong | seconds |
Returns
Type | Description |
---|---|
bool |