Class TokenAuthorization
- Namespace
- Dynamicweb.Security.Utilities
- Assembly
- Dynamicweb.Core.dll
Provides methods for performing token-based authorization. This class cannot be inherited.
public class TokenAuthorization
- Inheritance
-
TokenAuthorization
- Inherited Members
Properties
Tag
Gets the name of the request item that is being checked for authorization token presence.
public static string Tag { get; }
Property Value
Methods
IssueToken()
Issues a new token.
public static string IssueToken()
Returns
- string
Token.
IssueToken(bool)
Issues a new token.
public static string IssueToken(bool throwOnError)
Parameters
throwOnErrorboolValue indicating whether to throw exception if token cannot be issued.
Returns
- string
Token.
Exceptions
- InvalidOperationException
Token cannot be issued.
RemoveTokenDefinition(string)
Removes the token definition from the given URI string.
public static string RemoveTokenDefinition(string uri)
Parameters
uristringURI to remove token definition from.
Returns
- string
URI with removed token definition.
Revoke(IRequest)
Revokes the given authorization token.
public static void Revoke(IRequest request)
Parameters
requestIRequestHTTP request containing token information.
Revoke(string)
Revokes the given authorization token.
public static void Revoke(string token)
Parameters
tokenstringToken to revoke.
Validate(IRequest)
Validates the given token.
public static bool Validate(IRequest request)
Parameters
requestIRequestHTTP request containing token information.
Returns
- bool
Value indicating whether the given token is valid.
Validate(string)
Validates the given token.
public static bool Validate(string token)
Parameters
tokenstringToken to validate.
Returns
- bool
Value indicating whether the given token is valid.
ValidateAndRevoke(IRequest)
Validates the given token and revokes it right away.
public static bool ValidateAndRevoke(IRequest request)
Parameters
requestIRequestHTTP request containing token information.
Returns
- bool
Value indicating whether the given token is valid.
ValidateAndRevoke(string)
Validates the given token and revokes it right away.
public static bool ValidateAndRevoke(string token)
Parameters
tokenstringToken to validate.
Returns
- bool
Value indicating whether the given token is valid.