Added the ability to configure the JWT expiry date using a new server.jwtttl config parameter. #999

Merged
konrad merged 2 commits from stephen-hill/api:feature/jwt-ttl into main 2021-10-09 11:02:30 +00:00
Contributor

As per the title, this update allows the JWT expiry date to be configurable from the config file.

I have updated the sample config file.

The default TTL is 3 days.

This is the first time writing Go code, and contributing to this project, so I'm happy to accept any feedback.

As per the title, this update allows the JWT expiry date to be configurable from the config file. I have updated the sample config file. The default TTL is 3 days. This is the first time writing Go code, and contributing to this project, so I'm happy to accept any feedback.
stephen-hill added 1 commit 2021-10-08 15:43:29 +00:00
konrad reviewed 2021-10-08 20:48:02 +00:00
konrad left a comment
Owner

Thanks for the PR! It looks good overall.

Can you also run mage generate-docs to regenerate config docs?

Thanks for the PR! It looks good overall. Can you also run `mage generate-docs` to regenerate config docs?
@ -55,2 +55,4 @@
t := jwt.New(jwt.SigningMethodHS256)
var ttl = time.Duration(config.ServiceJWTTTL.GetInt64())
var exp = time.Now().Add(time.Second * ttl).Unix()
Owner

Did you try time.Second * config.ServiceJWTTTL.GetInt64()? I'm not 100% sure that works, but IIRC it should.

Did you try `time.Second * config.ServiceJWTTTL.GetInt64()`? I'm not 100% sure that works, but IIRC it should.
Author
Contributor

I did try that but got a type mismatch error.

I did try that but got a type mismatch error.
Owner

Ah, I wasn't sure about that.

Ah, I wasn't sure about that.
konrad marked this conversation as resolved
stephen-hill added 1 commit 2021-10-09 07:58:37 +00:00
continuous-integration/drone/pr Build is passing Details
669ac0db83
Updated config docs.
Author
Contributor

@konrad Docs regenerated.

@konrad Docs regenerated.
konrad merged commit 82a3330412 into main 2021-10-09 11:02:30 +00:00
konrad deleted branch feature/jwt-ttl 2021-10-09 11:02:30 +00:00
Owner

Thanks again!

Thanks again!
Member

👀

![](https://kolaente.dev/attachments/fbabc2b5-3124-41b9-8264-2746c5670a92) 👀
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#999
No description provided.