Interface IAuthTokenService
- Namespace
- GastroSky.Services.AuthTokenService
- Assembly
- GastroSky.dll
public interface IAuthTokenService
Methods
EmitAuthTokenForUserAccount(User)
Emits a new authentication token for a given userAccount.
string EmitAuthTokenForUserAccount(User userAccount)
Parameters
Returns
- string
The token string ready for the user to append to his subsequent requests (inside the
AuthorizationHTTP header with theBearerprefix).
EmitDefibrillatorTokenForUserAccount(User)
Emits a new defibrillator token useful for reviving dead sessions (expired).
Defi-Tokens have a slightly longer lifetime, but need to be handled with the same (if not more) care as the normal auth tokens.
string EmitDefibrillatorTokenForUserAccount(User userAccount)
Parameters
Returns
ExtractJwt(HttpContext)
Extracts the authorization header value from a request's HttpContext.
string? ExtractJwt(HttpContext httpContext)
Parameters
httpContextHttpContextHTTP request's HttpContext to extract the token from.
Returns
- string
The found JWT (
nullif no auth token was found inside the request's authorization header).
ValidateReviveRequest(ReviveRequestDto)
Checks whether a defibrillator token that was emitted by the EmitDefibrillatorTokenForUserAccount(User) method is valid or not.
string? ValidateReviveRequest(ReviveRequestDto dto)
Parameters
dtoReviveRequestDtoThe revival request DTO to check.
Returns
- string
nullif validation failed; thesubclaim value if validation was successful (which should correspond to the User's Slug value).
Remarks
This will NOT obliterate the token: do not forget to do that in case of validity and renewal!