54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package controllers
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"time"
|
|
)
|
|
|
|
type TokenController struct {
|
|
DB *sql.DB
|
|
}
|
|
|
|
type TokenData struct {
|
|
UUID string
|
|
UserID string
|
|
CreatedAt time.Time
|
|
LastUserAt time.Time
|
|
RevokedAt time.Time
|
|
ExpiredAt time.Time
|
|
Scopes *Scopes
|
|
}
|
|
|
|
type Scopes struct{}
|
|
|
|
// Create a new token, store its hash in the database and return the token value
|
|
func (ctrl *TokenController) Create(ctx context.Context) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
// Update token name or permissions, other changes are ignored by this method
|
|
func (ctrl *TokenController) Update(ctx context.Context) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
// ForceExpiration of a token, so it can no longer be used
|
|
func (ctrl *TokenController) ForceExpiration(ctx context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
// Regenerate a token and get a new value
|
|
func (ctrl *TokenController) Regenerate(ctx context.Context) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
// Get an existing token data
|
|
func (ctrl *TokenController) Get(ctx context.Context, uuid string) error {
|
|
return nil
|
|
}
|
|
|
|
// List all available token
|
|
func (ctrl *TokenController) List(ctx context.Context) error {
|
|
return nil
|
|
}
|