JwtTokenBuilder.RenewJwt method (1 of 2)
Renews a JWT token from the current request context, optionally extending its lifetime.
public string RenewJwt(KestrunContext ctx, TimeSpan? lifetime = default)
parameter | description |
---|---|
ctx | The Kestrun context containing the request and authorization header. |
lifetime | The new lifetime for the renewed token. If null, uses the builder’s default lifetime. |
Return Value
The renewed JWT token as a compact string.
Exceptions
exception | condition |
---|---|
UnauthorizedAccessException | Thrown if no Bearer token is provided in the request. |
See Also
- record KestrunContext
- class JwtTokenBuilder
- namespace Kestrun.Jwt
JwtTokenBuilder.RenewJwt method (2 of 2)
Extends the validity period of an existing JWT token by creating a new token with updated lifetime.
public string RenewJwt(string jwt, TimeSpan? lifetime = default)
parameter | description |
---|---|
jwt | The original JWT token to extend. |
lifetime | The new lifetime for the extended token. If null, uses the builder’s default lifetime. |
Return Value
The extended JWT token as a compact string.
See Also
- class JwtTokenBuilder
- namespace Kestrun.Jwt