4using System.Threading.Tasks;
24 : this(false, 0,
Users)
52 StringBuilder sb =
new StringBuilder();
54 sb.Append(
"OAUTH Client Credentials");
68 return Array.Empty<
string>();
86 Log.
Warning(
"Insecure authentication method used. Client credentials " +
87 "should be sent in the Authorization header, not as query parameters.",
95 Log.
Warning(
"Insecure authentication method used. Client credentials " +
96 "should be sent in the Authorization header, not as query parameters.",
107 if (Response.
Decoded is Dictionary<string, object> Data)
109 if (Data.TryGetValue(
"client_id", out
object Obj) && Obj is
string ClientId2 &&
110 Data.TryGetValue(
"client_secret", out Obj) && Obj is
string ClientSecret2)
114 else if (Data.TryGetValue(
"username", out Obj) && Obj is
string UserName &&
115 Data.TryGetValue(
"password", out Obj) && Obj is
string Password)
122 else if (Response.
Decoded is Dictionary<string, string> Form)
124 if (Form.TryGetValue(
"client_id", out ClientId) &&
125 Form.TryGetValue(
"client_secret", out ClientSecret))
129 else if (Form.TryGetValue(
"username", out ClientId) &&
130 Form.TryGetValue(
"password", out ClientSecret))
Contains information about a response to a content request.
bool HasError
If an error occurred.
object Decoded
Decoded object.
Static class managing the application event log. Applications and services log events on this static ...
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Basic authentication mechanism, as defined in RFC 2617: https://tools.ietf.org/html/rfc2617
override async Task< IUser > IsAuthenticated(HttpRequest Request)
Checks if the request is authorized.
Base class for all HTTP authentication schemes, as defined in RFC-7235: https://datatracker....
virtual void AppendEncryptionRequirement(StringBuilder DisplayName)
Appends any encryption requirement to the display name.
int MinStrength
Minimum security strength of algorithms used.
bool RequireEncryption
If scheme requires encryption.
Represents an HTTP request.
HttpRequestHeader Header
Request header.
string RemoteEndPoint
Remote end-point.
bool HasData
If the request has data.
async Task< ContentResponse > DecodeDataAsync()
Decodes data sent in request.
OAUTH Client Credentials authentication scheme, as defined in RFCs 6749.
override async Task< IUser?> IsAuthenticated(HttpRequest Request)
Checks if the request is authorized.
override string[] GetChallenges(HttpRequest Request)
Gets available challenges for the authenticating client to respond to.
override string DisplayName
Display name for authentication scheme.
OAuthClientCredentialsAuthentication(bool RequireEncryption, int MinStrength, IUserSource Users)
OAUTH Client Credentials authentication scheme, as defined in RFCs 6749.
IUserSource Users
Collection of users to authenticate against.
OAuthClientCredentialsAuthentication(IUserSource Users)
OAUTH Client Credentials authentication scheme, as defined in RFCs 6749.
Basic interface for a user.
Interface for data sources containing users.