Documentation ¶
Index ¶
- Constants
- Variables
- func CompareHashWithPassword(hash, password string) error
- func GeneratePasswordHash(s string) (string, error)
- func InitData(ctx context.Context) error
- func InitServiceBean(c config.Config) []interface{}
- func ParseToken(tokenString string) (*model.CustomClaims, error)
- type ArticleService
- type AuthenticationService
- type DataInit
- type UserService
Constants ¶
View Source
const ( // GrantTypeAccess is the grant type for access token GrantTypeAccess = "access" // GrantTypeRefresh is the grant type for refresh token GrantTypeRefresh = "refresh" )
Variables ¶
View Source
var SignedKey = "fiber-realworld"
SignedKey is the signed key of JWT
Functions ¶
func CompareHashWithPassword ¶
func GeneratePasswordHash ¶
func InitServiceBean ¶
InitServiceBean init all service instance
func ParseToken ¶
func ParseToken(tokenString string) (*model.CustomClaims, error)
Types ¶
type ArticleService ¶
type ArticleService interface { CreateArticle(c *fiber.Ctx, req *apiv1.ArticleRequest) (*apiv1.ArticleResponse, error) UpdateArticle(c *fiber.Ctx, req *apiv1.ArticleRequest) (*apiv1.ArticleResponse, error) GetArticle(c *fiber.Ctx) (*apiv1.ArticleResponse, error) GetArticles(c *fiber.Ctx) (*apiv1.ArticlesResponse, error) FavoriteArticle(c *fiber.Ctx) (*apiv1.ArticleResponse, error) UnFavoriteArticle(c *fiber.Ctx) (*apiv1.ArticleResponse, error) }
func NewArticleService ¶
func NewArticleService() ArticleService
type AuthenticationService ¶
type AuthenticationService interface { Login(c *fiber.Ctx, loginReq apisv1.LoginRequest) error RefreshToken(c *fiber.Ctx, refreshToken string) (*apisv1.RefreshTokenResponse, error) GetCurrentUser(c *fiber.Ctx) (*apisv1.LoginResponse, error) GetToken(c *fiber.Ctx) (string, error) GenerateJWTToken(email, grantType string, expireDuration time.Duration) (string, error) AuthRequired() fiber.Handler // contains filtered or unexported methods }
AuthenticationService is the service of authentication
func NewAuthenticationService ¶
func NewAuthenticationService() AuthenticationService
NewAuthenticationService new authentication service
type UserService ¶
type UserService interface { GetUser(c *fiber.Ctx, email string) (*model.User, error) GetUserByEmail(c *fiber.Ctx, email string) (*apisv1.UserBase, error) CreateUser(c *fiber.Ctx, req apisv1.UserRequest) error UpdateUser(c *fiber.Ctx, req apisv1.UserRequest) error }
func NewUserService ¶
func NewUserService() UserService
Click to show internal directories.
Click to hide internal directories.