Unfake the authentication

This commit is contained in:
Tracker-Friendly 2025-03-20 18:39:49 +00:00
parent 6def9f892b
commit 5d40a577cc

14
main.go
View file

@ -55,17 +55,7 @@ func log(message string, messageType library.MessageCode) {
Information.SendISMessage(loggerService, messageType, message)
}
// Authenticate Fake for testing
func Authenticate(_ string, _ OAuthConfig) (uuid.UUID, error) {
return uuid.MustParse("ef585ba0-0ac6-48f8-8ebb-2b6cd97d6a21"), nil
}
// GetUsername Fake for testing
func GetUsername(_ string, _ OAuthConfig) (string, error) {
return "arzumify", nil
}
func RAuthenticate(token string, config OAuthConfig) (uuid.UUID, error) {
func Authenticate(token string, config OAuthConfig) (uuid.UUID, error) {
parsedToken, err := jwt.Parse(token, func(token *jwt.Token) (interface{}, error) {
return config.PublicKey, nil
})
@ -90,7 +80,7 @@ func RAuthenticate(token string, config OAuthConfig) (uuid.UUID, error) {
return uuid.MustParse(claims["sub"].(string)), nil
}
func RGetUsername(token string, config OAuthConfig) (string, error) {
func GetUsername(token string, config OAuthConfig) (string, error) {
var responseData struct {
Username string `json:"username"`
}