Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseToken ¶
Validates the provided JWT against the known secret for the Daemon and returns the parsed data. This function DOES NOT validate that the token is valid for the connected server, nor does it ensure that the user providing the token is able to actually do things.
This simply returns a parsed token.
Types ¶
type BackupPayload ¶
type BackupPayload struct { jwt.Payload ServerUuid string `json:"server_uuid"` BackupUuid string `json:"backup_uuid"` UniqueId string `json:"unique_id"` }
func (*BackupPayload) GetPayload ¶
func (p *BackupPayload) GetPayload() *jwt.Payload
Returns the JWT payload.
func (*BackupPayload) IsUniqueRequest ¶
func (p *BackupPayload) IsUniqueRequest() bool
Determines if this JWT is valid for the given request cycle. If the unique ID passed in the token has already been seen before this will return false. This allows us to use this JWT as a one-time token that validates all of the request.
type FilePayload ¶
type FilePayload struct { jwt.Payload FilePath string `json:"file_path"` ServerUuid string `json:"server_uuid"` UniqueId string `json:"unique_id"` }
func (*FilePayload) GetPayload ¶
func (p *FilePayload) GetPayload() *jwt.Payload
Returns the JWT payload.
func (*FilePayload) IsUniqueRequest ¶
func (p *FilePayload) IsUniqueRequest() bool
Determines if this JWT is valid for the given request cycle. If the unique ID passed in the token has already been seen before this will return false. This allows us to use this JWT as a one-time token that validates all of the request.
type TokenStore ¶
func (*TokenStore) IsValidToken ¶
func (t *TokenStore) IsValidToken(token string) bool
Checks if a token is valid or not.
type TransferPayload ¶
type TransferPayload struct {
jwt.Payload
}
func (*TransferPayload) GetPayload ¶
func (p *TransferPayload) GetPayload() *jwt.Payload
GetPayload returns the JWT payload.
type UploadPayload ¶
type UploadPayload struct { jwt.Payload ServerUuid string `json:"server_uuid"` UniqueId string `json:"unique_id"` }
func (*UploadPayload) GetPayload ¶
func (p *UploadPayload) GetPayload() *jwt.Payload
Returns the JWT payload.
func (*UploadPayload) IsUniqueRequest ¶
func (p *UploadPayload) IsUniqueRequest() bool
Determines if this JWT is valid for the given request cycle. If the unique ID passed in the token has already been seen before this will return false. This allows us to use this JWT as a one-time token that validates all of the request.
type WebsocketPayload ¶
type WebsocketPayload struct { jwt.Payload sync.RWMutex UserID json.Number `json:"user_id"` ServerUUID string `json:"server_uuid"` Permissions []string `json:"permissions"` }
func (*WebsocketPayload) GetPayload ¶
func (p *WebsocketPayload) GetPayload() *jwt.Payload
Returns the JWT payload.
func (*WebsocketPayload) GetServerUuid ¶
func (p *WebsocketPayload) GetServerUuid() string
func (*WebsocketPayload) HasPermission ¶
func (p *WebsocketPayload) HasPermission(permission string) bool
Checks if the given token payload has a permission string.