brycx / pasetors

PASETOrs: PASETO tokens in pure Rust
MIT License
83 stars 8 forks source link

Implement Claim::set_expires_in #107

Closed franklx closed 7 months ago

franklx commented 7 months ago

Implemented new function Claim::set_expires_in(&mut self, duration: &core::time::Duration) -> Result<(), Error> useful for refreshing claims on expired tokens. Used it even for new and new_expires_in constructors.

brycx commented 7 months ago

Hi, sorry for the wait. I'll try to get this reviewed within the next few days.

franklx commented 7 months ago

I'm working on an actix-web paseto-based authentication middleware: franklx/actix-paseto-auth-middleware.

When the _accesstoken is expired is convenient using it as base for creating a new one based on _refreshtoken (like original implementation based on jwt does).

If you are interested here is where the token is created by calling a "polymorphic" function defined here where the set_expires_in is called.

brycx commented 7 months ago

@franklx Thanks for clarifying. Off the top of my head, this seems fine to me. I'll get this merged and issue a new release.

Out in 0.6.8.