accesstoken

package
v0.0.0-...-6cdb919 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RobotEmailSuffix = "@noreply.com"
	NeverExpire      = "never"
	ExpiresAtFormat  = "2006-01-02"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	CreateResourceAccessToken(ctx context.Context, request CreateResourceAccessTokenRequest,
		resourceType string, resourceID uint) (*CreateResourceAccessTokenResponse, error)
	CreatePersonalAccessToken(ctx context.Context,
		request CreatePersonalAccessTokenRequest) (*CreatePersonalAccessTokenResponse, error)
	ListPersonalAccessTokens(ctx context.Context,
		query *q.Query) (accessTokens []PersonalAccessToken, total int, err error)
	ListResourceAccessTokens(ctx context.Context, resourceType string,
		resourceID uint, query *q.Query) (accessTokens []ResourceAccessToken, total int, err error)
	RevokePersonalAccessToken(ctx context.Context, id uint) error
	RevokeResourceAccessToken(ctx context.Context, id uint) error
}

func NewController

func NewController(param *param.Param) Controller

type CreatePersonalAccessTokenRequest

type CreatePersonalAccessTokenRequest struct {
	Name      string   `json:"name"`
	Scopes    []string `json:"scopes"`
	ExpiresAt string   `json:"expiresAt"`
}

type CreatePersonalAccessTokenResponse

type CreatePersonalAccessTokenResponse struct {
	PersonalAccessToken
	Token string `json:"token"`
}

type CreateResourceAccessTokenRequest

type CreateResourceAccessTokenRequest struct {
	CreatePersonalAccessTokenRequest
	Role string `json:"role"`
}

type CreateResourceAccessTokenResponse

type CreateResourceAccessTokenResponse struct {
	ResourceAccessToken
	Token string `json:"token"`
}

type PersonalAccessToken

type PersonalAccessToken struct {
	CreatePersonalAccessTokenRequest
	ID        uint                  `json:"id"`
	CreatedAt time.Time             `json:"createdAt"`
	CreatedBy *usermodels.UserBasic `json:"createdBy"`
}

type ResourceAccessToken

type ResourceAccessToken struct {
	CreateResourceAccessTokenRequest
	ID        uint                  `json:"id"`
	CreatedAt time.Time             `json:"createdAt"`
	CreatedBy *usermodels.UserBasic `json:"createdBy"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL