Unfake the authentication
This commit is contained in:
parent
6def9f892b
commit
5d40a577cc
1 changed files with 2 additions and 12 deletions
14
main.go
14
main.go
|
@ -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"`
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue