Documentation
¶
Overview ¶
* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.
Index ¶
- func CreatePolicy(c echo.Context) error
- func CreateToken(c echo.Context) error
- func DeletePolicy(c echo.Context) error
- func GetPolicies(c echo.Context) error
- func GetPolicy(c echo.Context) error
- func RenewToken(c echo.Context) error
- func ValidateEmbargoToken(next echo.HandlerFunc) echo.HandlerFunc
- type EmbargoPolicy
- type EmbargoToken
- type EmbargoTokenResponse
- type GetPoliciesResponse
- type PolicyPath
- type PostedPolicyRequest
- type PostedTokenRenewRequest
- type PostedTokenRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePolicy ¶
func CreateToken ¶
func DeletePolicy ¶
func GetPolicies ¶
func RenewToken ¶
func ValidateEmbargoToken ¶
func ValidateEmbargoToken(next echo.HandlerFunc) echo.HandlerFunc
Middleware function to validate Embargo token
Types ¶
type EmbargoPolicy ¶
type EmbargoToken ¶
type EmbargoToken struct {
TokenID uuid.UUID
TokenHash string
DisplayName string
CreatedAt time.Time
UpdatedAt time.Time
Ttl int
Renewable bool
Root bool
Orphan bool
Parent uuid.UUID
Policies []uuid.UUID
Metadata map[string]string
}
func CreateEmbargoToken ¶
func CreateEmbargoToken(name string, ttl int, renewable bool, root bool, orphen bool, parent uuid.UUID, policies []uuid.UUID, metadata map[string]string) (EmbargoToken, string)
Create a new Embaro token
func ValidateToken ¶
func ValidateToken(token string) (EmbargoToken, bool)
Check if a token is valid
type EmbargoTokenResponse ¶
type EmbargoTokenResponse struct {
Token string `json:"token"`
DisplayName string `json:"display_name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Ttl int `json:"ttl"`
Renewable bool `json:"renewable"`
Root bool `json:"root"`
Orphan bool `json:"orphan"`
Parent uuid.UUID `json:"parent"`
Policies []uuid.UUID `json:"policies"`
Metadata map[string]string `json:"metadata"`
}
type GetPoliciesResponse ¶
type GetPoliciesResponse struct {
Data []EmbargoPolicy `json:"data"`
Total int `json:"total"`
}
type PolicyPath ¶
type PostedPolicyRequest ¶
type PostedPolicyRequest struct {
PolicyName string `json:"policy_name" validate:"required"`
Paths []PolicyPath `json:"paths" validate:"required"`
}
type PostedTokenRenewRequest ¶
type PostedTokenRenewRequest struct {
Ttl int `json:"duration"`
}
Click to show internal directories.
Click to hide internal directories.