Recent

Author Topic: TJWT question  (Read 5449 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
TJWT question
« on: July 30, 2018, 11:25:29 pm »
Hi guys, I have to do an authentication system for software written in lazarus (and indy) to get an MVC site where the model is managed with json results. To get the json data I make GET calls to get the data. Up to here everything is ok. What I would like to understand is how to make an authentication system based on the JWT token. I saw that with the fpjwt unit it is possible to create one. But who has a small example to understand how to make it? Also you have other condyles to give me?

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
Re: TJWT question
« Reply #1 on: July 31, 2018, 11:16:02 am »
No help?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: TJWT question
« Reply #2 on: July 31, 2018, 03:33:41 pm »
I took a look at FPJWT yesterday, it seems pretty straight forward, except I can't figure out how to create the secret or private claims  :/

https://github.com/graemeg/freepascal/blob/master/packages/fcl-web/src/base/fpjwt.pp


Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: TJWT question
« Reply #3 on: July 31, 2018, 03:55:29 pm »
Good article about JWTs - https://jwt.io/introduction/

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
Re: TJWT question
« Reply #4 on: July 31, 2018, 04:06:28 pm »
Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: TJWT question
« Reply #5 on: July 31, 2018, 04:13:49 pm »
The short version though: Token data is safely verifiable, but the data is not secure.

You have to encrypt data you put in the token if you want it to be safe, and use all the standard best practices for encryption security.

So using it for authentication usually means using the 'exp' claim (expiration), encrypt the data inside the tokens private claims, and verify that each time it's used.

anfm

  • Newbie
  • Posts: 2
Re: TJWT question
« Reply #6 on: October 24, 2022, 09:44:30 pm »
Hi guys, I have to do an authentication system for software written in lazarus (and indy) to get an MVC site where the model is managed with json results. To get the json data I make GET calls to get the data. Up to here everything is ok. What I would like to understand is how to make an authentication system based on the JWT token. I saw that with the fpjwt unit it is possible to create one. But who has a small example to understand how to make it? Also you have other condyles to give me?

Thank you
Check this repository - https://github.com/andre-djsystem/LazJWT

 

TinyPortal © 2005-2018