Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AccessTokenType = "2"
View Source
var RefreshTokenType = "1"
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface { // Sings in a user with authenticating username and password SignIn(db *sql.DB, ctx context.Context, username string, password string) *models.User // Signs up a user with minimum required fields SignUp(db *sql.DB, ctx context.Context, username string, password string, display_name string) *models.User }
type TokenService ¶
type TokenService interface { // Returns token string, expire time and error CreateAccessToken(user *models.User, ctx context.Context) (string, time.Time) // Returns refresh token object, expire time and error CreateRefreshToken(db *sql.DB, ctx context.Context, user *models.User) (string, time.Time) // Returns a refresh token from database GetRefreshToken(db *sql.DB, ctx context.Context, token string) *models.RefreshToken // Returns a refresh token from database without panic SafeGetRefreshToken(db *sql.DB, ctx context.Context, token string) *models.RefreshToken // Deletes a refresh token from database DeleteRefreshToken(db *sql.DB, ctx context.Context, token string) }
type UserService ¶
type UserService interface { // Returns user model object based on username GetUser(db *sql.DB, ctx context.Context, username string) *models.User // Returns user model object based on username safe SafeGetUser(db *sql.DB, ctx context.Context, username string) *models.User // Creates a user based on required data CreateUser(db *sql.DB, ctx context.Context, username string, password string, display_name string) *models.User // Returns user model object based on id GetUserByID(db *sql.DB, ctx context.Context, id string) *models.User // Checks if the passwords match CheckPasswordHash(password, hash string) bool // Hashes received password HashPassword(password string) string }
Click to show internal directories.
Click to hide internal directories.