feat(veans): require APIToken.ExpiresAt with FarFuture sentinel
This commit is contained in:
parent
6b48a37710
commit
1f5abaa6fb
|
|
@ -140,17 +140,23 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIToken is the request and response shape for `PUT /tokens`. The plaintext
|
// APIToken is the request and response shape for `PUT /tokens`. The plaintext
|
||||||
// `Token` field is only populated on creation.
|
// `Token` field is only populated on creation. Vikunja requires ExpiresAt;
|
||||||
|
// callers that want a long-lived token use FarFuture (year 9999).
|
||||||
type APIToken struct {
|
type APIToken struct {
|
||||||
ID int64 `json:"id,omitempty"`
|
ID int64 `json:"id,omitempty"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Token string `json:"token,omitempty"`
|
Token string `json:"token,omitempty"`
|
||||||
Permissions map[string][]string `json:"permissions"`
|
Permissions map[string][]string `json:"permissions"`
|
||||||
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
ExpiresAt time.Time `json:"expires_at"`
|
||||||
OwnerID int64 `json:"owner_id,omitempty"`
|
OwnerID int64 `json:"owner_id,omitempty"`
|
||||||
Created time.Time `json:"created,omitempty"`
|
Created time.Time `json:"created,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FarFuture is what veans uses for "no expiry" since Vikunja's API token
|
||||||
|
// model marks expires_at as required. Year 9999 is well past any reasonable
|
||||||
|
// rotation horizon and is what the frontend uses for its "never" option.
|
||||||
|
var FarFuture = time.Date(9999, time.December, 31, 0, 0, 0, 0, time.UTC)
|
||||||
|
|
||||||
// Info is the parsed shape of `GET /info`.
|
// Info is the parsed shape of `GET /info`.
|
||||||
type Info struct {
|
type Info struct {
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue