using System; using System.Collections.Generic; namespace DevHive.Common.Jwt.Interfaces { public interface IJwtService { /// /// The generation of a JWT, when a new user registers or log ins /// Tokens have an expiration time of 7 days. /// /// User's Guid /// Users's username /// List of user's roles /// Return a new JWT, containing the user id, username and roles. string GenerateJwtToken(Guid userId, string username, List roleNames); /// /// Checks whether the given user, gotten by the "id" property, /// is the same user as the one in the token (unless the user in the token has the admin role) /// and the roles in the token are the same as those in the user, gotten by the id in the token /// /// Guid of the user being validated /// The raw token coming from the request /// Bool result of is the user authenticated to do an action bool ValidateToken(Guid userId, string rawToken); } }