1using System.Threading.Tasks;
17 private readonly
string[] privileges;
18 private readonly
string userVariable;
19 private readonly
string loginPage;
28 : this(
"User", string.Empty, Server, Privileges)
40 : this(UserVariable, string.Empty, Server, Privileges)
54 this.userVariable = UserVariable;
55 this.loginPage = LoginPage;
57 this.privileges = Privileges;
66 foreach (
string Privilege
in this.privileges)
85 Request.Session =
Variables = this.server.GetSession(HttpSessionID);
90 !(v.ValueObject is
IUser User))
92 if (!
string.IsNullOrEmpty(this.loginPage))
95 return Task.FromResult<
IUser>(
null);
98 foreach (
string Privilege
in this.privileges)
100 if (!User.HasPrivilege(Privilege))
101 return Task.FromResult<
IUser>(
null);
104 return Task.FromResult(User);
Authentication mechanism that makes sure the user has an established session with the IoT Gateway,...
RequiredUserPrivileges(string UserVariable, HttpServer Server, params string[] Privileges)
Authentication mechanism that makes sure the user has an established session with the IoT Gateway,...
override string GetChallenge()
Gets a challenge for the authenticating client to respond to.
override Task< IUser > IsAuthenticated(HttpRequest Request)
Checks if the request is authorized.
RequiredUserPrivileges(HttpServer Server, params string[] Privileges)
Authentication mechanism that makes sure the user has an established session with the IoT Gateway,...
RequiredUserPrivileges(string UserVariable, string LoginPage, HttpServer Server, params string[] Privileges)
Authentication mechanism that makes sure the user has an established session with the IoT Gateway,...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
static ForbiddenException AccessDenied(string ObjectId, string ActorId, string MissingPrivilege)
Returns a ForbiddenException object, and logs a entry in the event log about the event.
Base class for all HTTP authentication schemes, as defined in RFC-7235: https://datatracker....
Represents an HTTP request.
HttpRequestHeader Header
Request header.
Variables Session
Contains session states, if the resource requires sessions, or null otherwise.
HttpResponse Response
HTTP Response object, if one has been assigned to the request.
Base class for all HTTP resources.
static string GetSessionId(HttpRequest Request, HttpResponse Response)
Gets the session ID used for a request.
Implements an HTTP server.
The response to the request can be found under a different URI and SHOULD be retrieved using a GET me...
Contains information about a variable.
virtual bool TryGetVariable(string Name, out Variable Variable)
Tries to get a variable object, given its name.
Basic interface for a user.