feat(auth): implement yggdrasil authenticate endpoint
This commit is contained in:
36
internal/models/auth.go
Normal file
36
internal/models/auth.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
// Agent представляет информацию о лаунчере, который делает запрос
|
||||
type Agent struct {
|
||||
Name string `json:"name"` // "Minecraft"
|
||||
Version int `json:"version"` // 1
|
||||
}
|
||||
|
||||
// AuthenticateRequest - это тело запроса на /authserver/authenticate
|
||||
type AuthenticateRequest struct {
|
||||
Agent Agent `json:"agent"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
ClientToken string `json:"clientToken"`
|
||||
}
|
||||
|
||||
// ProfileInfo содержит краткую информацию о профиле игрока
|
||||
type ProfileInfo struct {
|
||||
ID string `json:"id"` // UUID пользователя без дефисов
|
||||
Name string `json:"name"` // Никнейм пользователя
|
||||
}
|
||||
|
||||
// AuthenticateResponse - это тело успешного ответа
|
||||
type AuthenticateResponse struct {
|
||||
AccessToken string `json:"accessToken"`
|
||||
ClientToken string `json:"clientToken"`
|
||||
AvailableProfiles []ProfileInfo `json:"availableProfiles"`
|
||||
SelectedProfile ProfileInfo `json:"selectedProfile"`
|
||||
User *UserProperty `json:"user,omitempty"` // Необязательное поле с доп. свойствами
|
||||
}
|
||||
|
||||
// UserProperty - часть ответа, может содержать доп. свойства пользователя
|
||||
type UserProperty struct {
|
||||
ID string `json:"id"` // UUID пользователя
|
||||
Properties []any `json:"properties"` // Обычно пустой массив
|
||||
}
|
||||
Reference in New Issue
Block a user