-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/pterodactyl/wings into d…
…evelop
- Loading branch information
Showing
4 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package tokens | ||
|
||
import ( | ||
"github.com/gbrlsnchs/jwt/v3" | ||
) | ||
|
||
type UploadPayload struct { | ||
jwt.Payload | ||
|
||
ServerUuid string `json:"server_uuid"` | ||
UniqueId string `json:"unique_id"` | ||
} | ||
|
||
// Returns the JWT payload. | ||
func (p *UploadPayload) GetPayload() *jwt.Payload { | ||
return &p.Payload | ||
} | ||
|
||
// 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. | ||
func (p *UploadPayload) IsUniqueRequest() bool { | ||
return getTokenStore().IsValidToken(p.UniqueId) | ||
} |