Skip to content

giorgiobazzo/horse-jwt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

horse-jwt

Middleware for JWT in HORSE

Sample Horse Server Validate JWT

uses
  Horse, Horse.JWT;

var
  App: THorse;

begin
  App := THorse.Create(9000);

  App.Use(HorseJWT('jwt-secret')); 

  App.Post('ping',
    procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
    begin
      Req.Session<TJSONObject>; //Default Payload is JSON
    end);

  App.Start;

Validate JWT and get custom session

uses
  Horse, Horse.JWT;

var
  App: THorse;

begin
  App := THorse.Create(9000);

  App.Use(HorseJWT('jwt-secret', TMySession)); 

  App.Post('ping',
    procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
    begin
      Req.Session<TMySession>.MyField;
    end);

  App.Start;

About

Middleware for JWT in HORSE

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Pascal 100.0%