Skip to content

Commit 82f783f

Browse files
Update README.md
1 parent 3266079 commit 82f783f

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# horse-basic-auth
1+
# horse-basic-auth
2+
3+
Middleware for Basic Authentication in HORSE
4+
5+
Sample Horse server validate basic authentication:
6+
7+
```delphi
8+
uses
9+
Horse, Horse.BasicAuthentication;
10+
11+
var
12+
App: THorse;
13+
14+
begin
15+
App := THorse.Create(9000);
16+
17+
App.Use(HorseBasicAuthentication(
18+
function(const AUsername, APassword: string): Boolean
19+
begin
20+
Result := AUsername.Equals('user') and APassword.Equals('password');
21+
end));
22+
23+
App.Post('ping',
24+
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
25+
begin
26+
Req.Send('pong');
27+
end);
28+
29+
App.Start;
30+
```

0 commit comments

Comments
 (0)