handlers

package
v0.0.0-...-e984f34 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 43 Imported by: 0

Documentation

Overview

handlers/lineage.go

Index

Constants

View Source
const (
	AccessLevelList   = "list"
	AccessLevelRead   = "read"
	AccessLevelCreate = "create"
	AccessLevelUpdate = "update"
	AccessLevelDelete = "delete"
	AccessLevelOwner  = "owner"
)

Variables

View Source
var (
	KeycloakURL = "http://localhost:9999"
	ClientID    = "apiClient"
	ClientSecet = "4NZ9L23PRPEo51yZnclWCbXEyWU70rgU"
	Realm       = "myrealm"
)

Functions

func CombineShares

func CombineShares(shares [][]byte) ([]byte, error)

CombineShares combines the shares to reconstruct the master key

func TLSAuthMiddleware

func TLSAuthMiddleware(next http.Handler) http.Handler

TLSAuthMiddleware is a middleware to handle TLS authentication

Types

type CertificateAuthorityInput

type CertificateAuthorityInput struct {
	Name        string `json:"name"`
	CACert      string `json:"ca_cert"`
	PrivateKey  string `json:"private_key"`
	Description string `json:"description"`
}

type CreateKeyRequest

type CreateKeyRequest struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Request and Response Types

type CreateKeyResponse

type CreateKeyResponse struct {
	KeyID        string    `json:"key_id"`
	CreationDate time.Time `json:"creation_date"`
}

type CreateSecretRequest

type CreateSecretRequest struct {
	PathID           string                 `json:"path_id"`
	Key              string                 `json:"key"`
	Value            string                 `json:"value"`
	MultiValue       map[string]interface{} `json:"multi_value"`
	ExpiresAt        *time.Time             `json:"expires_at,omitempty"`
	Metadata         map[string]interface{} `json:"metadata"`
	IsOneTime        bool                   `json:"is_one_time"`
	RotationInterval string                 `json:"rotation_interval"`
	IsMultiValue     bool                   `json:"is_multi_value"`
	Path             string                 `json:"path"`
	Tags             []string               `json:"tags"`
}

type DecryptRequest

type DecryptRequest struct {
	KeyID      string `json:"key_id"`
	Ciphertext string `json:"ciphertext"`
}

type DecryptResponse

type DecryptResponse struct {
	Plaintext string `json:"plaintext"`
}

type EncryptRequest

type EncryptRequest struct {
	KeyID     string `json:"key_id"`
	Plaintext string `json:"plaintext"`
}

type EncryptResponse

type EncryptResponse struct {
	Ciphertext string `json:"ciphertext"`
}

type GeneratedCertificate

type GeneratedCertificate struct {
	Certificate string `json:"certificate"`
	PrivateKey  string `json:"private_key"`
}

type Handler

type Handler struct {
	DB        *pg.DB
	Config    config.Config
	CryptoOps crypt.CryptographicOperations
	// Z         zanzibar.Zanzibar
	Producer messaging.Producer
	Consumer messaging.Consumer
	KAuth    *keycloak.KAuth
	JWTKey   []byte
}

func Init

func Init(config *config.Config) *Handler

func (*Handler) AccessSecret

func (h *Handler) AccessSecret(w http.ResponseWriter, r *http.Request)
func (h *Handler) AccessSharedLink(w http.ResponseWriter, r *http.Request)

Access a shared link

func (*Handler) AddUserToGroup

func (h *Handler) AddUserToGroup(w http.ResponseWriter, r *http.Request)

func (*Handler) ApproveRequest

func (h *Handler) ApproveRequest(w http.ResponseWriter, r *http.Request)

func (*Handler) AuthKeycloak

func (h *Handler) AuthKeycloak(w http.ResponseWriter, r *http.Request)

func (*Handler) Authenticate

func (h *Handler) Authenticate(next http.Handler) http.Handler

func (*Handler) AuthenticateAppRole

func (h *Handler) AuthenticateAppRole(w http.ResponseWriter, r *http.Request)

func (*Handler) AuthenticateUser

func (h *Handler) AuthenticateUser(w http.ResponseWriter, r *http.Request)

func (*Handler) CheckPermission

func (h *Handler) CheckPermission(permission string, next http.Handler) http.Handler

func (*Handler) CreateAppRole

func (h *Handler) CreateAppRole(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateApprovalRequest

func (h *Handler) CreateApprovalRequest(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateClientCert

func (h *Handler) CreateClientCert(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateGroup

func (h *Handler) CreateGroup(w http.ResponseWriter, r *http.Request)

func (*Handler) CreatePath

func (h *Handler) CreatePath(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateSecret

func (h *Handler) CreateSecret(w http.ResponseWriter, r *http.Request)
func (h *Handler) CreateSharedLink(w http.ResponseWriter, r *http.Request)

Create a shared link

func (*Handler) CreateUser

func (h *Handler) CreateUser(w http.ResponseWriter, r *http.Request)

func (*Handler) Decrypt

func (h *Handler) Decrypt(w http.ResponseWriter, r *http.Request)

func (*Handler) DeletePolicy

func (h *Handler) DeletePolicy(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteSecret

func (h *Handler) DeleteSecret(w http.ResponseWriter, r *http.Request)

func (*Handler) DownloadCA

func (h *Handler) DownloadCA(w http.ResponseWriter, r *http.Request)

func (*Handler) DownloadCertificate

func (h *Handler) DownloadCertificate(w http.ResponseWriter, r *http.Request)

func (*Handler) DownloadClientCA

func (h *Handler) DownloadClientCA(w http.ResponseWriter, r *http.Request)

func (*Handler) Encrypt

func (h *Handler) Encrypt(w http.ResponseWriter, r *http.Request)

Handlers

func (*Handler) ExecuteWorkflow

func (h *Handler) ExecuteWorkflow(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAppRoles

func (h *Handler) GetAppRoles(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAuditLogs

func (h *Handler) GetAuditLogs(w http.ResponseWriter, r *http.Request)

func (*Handler) GetDashboardSummary

func (h *Handler) GetDashboardSummary(w http.ResponseWriter, r *http.Request)

func (*Handler) GetDeletedSecrets

func (h *Handler) GetDeletedSecrets(w http.ResponseWriter, r *http.Request)

func (*Handler) GetEvents

func (h *Handler) GetEvents(w http.ResponseWriter, r *http.Request)

func (*Handler) GetNotifications

func (h *Handler) GetNotifications(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPath

func (h *Handler) GetPath(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPathPermissions

func (h *Handler) GetPathPermissions(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPathPolicy

func (h *Handler) GetPathPolicy(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPolicies

func (h *Handler) GetPolicies(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPolicyAuditLogs

func (h *Handler) GetPolicyAuditLogs(w http.ResponseWriter, r *http.Request)

func (*Handler) GetRecentActivity

func (h *Handler) GetRecentActivity(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSecret

func (h *Handler) GetSecret(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSecretHistory

func (h *Handler) GetSecretHistory(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSecretLineage

func (h *Handler) GetSecretLineage(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSecretVersion

func (h *Handler) GetSecretVersion(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSecrets

func (h *Handler) GetSecrets(w http.ResponseWriter, r *http.Request)

func (*Handler) GetTemplates

func (h *Handler) GetTemplates(w http.ResponseWriter, r *http.Request)

func (*Handler) GetWorkflow

func (h *Handler) GetWorkflow(w http.ResponseWriter, r *http.Request)

func (*Handler) GetWorkflows

func (h *Handler) GetWorkflows(w http.ResponseWriter, r *http.Request)

func (*Handler) Hmac

func (h *Handler) Hmac(w http.ResponseWriter, r *http.Request)

func (*Handler) HmacVerify

func (h *Handler) HmacVerify(w http.ResponseWriter, r *http.Request)

func (*Handler) ListAllPaths

func (h *Handler) ListAllPaths(w http.ResponseWriter, r *http.Request)

ListAllPaths returns all paths regardless of permissions

func (*Handler) ListApprovalRequests

func (h *Handler) ListApprovalRequests(w http.ResponseWriter, r *http.Request)

func (*Handler) ListClientCerts

func (h *Handler) ListClientCerts(w http.ResponseWriter, r *http.Request)

func (*Handler) ListGroupUsers

func (h *Handler) ListGroupUsers(w http.ResponseWriter, r *http.Request)

func (*Handler) ListGroups

func (h *Handler) ListGroups(w http.ResponseWriter, r *http.Request)

func (*Handler) ListTransitKeys

func (h *Handler) ListTransitKeys(w http.ResponseWriter, r *http.Request)

func (*Handler) ListUserGroups

func (h *Handler) ListUserGroups(w http.ResponseWriter, r *http.Request)

func (*Handler) ListUserPaths

func (h *Handler) ListUserPaths(w http.ResponseWriter, r *http.Request)

func (*Handler) ListUsers

func (h *Handler) ListUsers(w http.ResponseWriter, r *http.Request)

func (*Handler) LogSecretAccess

func (h *Handler) LogSecretAccess(secretID, userID string, source string) error

func (*Handler) NewHandler

func (h *Handler) NewHandler() *mux.Router

func (*Handler) RegisterUser

func (h *Handler) RegisterUser(w http.ResponseWriter, r *http.Request)

func (*Handler) RejectRequest

func (h *Handler) RejectRequest(w http.ResponseWriter, r *http.Request)

func (*Handler) RemoveUserFromGroup

func (h *Handler) RemoveUserFromGroup(w http.ResponseWriter, r *http.Request)

func (*Handler) RestoreDeletedSecret

func (h *Handler) RestoreDeletedSecret(w http.ResponseWriter, r *http.Request)

func (*Handler) RotateSecret

func (h *Handler) RotateSecret(w http.ResponseWriter, r *http.Request)

func (*Handler) SaveOrCreateWorkflow

func (h *Handler) SaveOrCreateWorkflow(w http.ResponseWriter, r *http.Request)

func (*Handler) SavePolicy

func (h *Handler) SavePolicy(w http.ResponseWriter, r *http.Request)

func (*Handler) ScanForSecrets

func (h *Handler) ScanForSecrets(w http.ResponseWriter, r *http.Request)

func (*Handler) SealHandler

func (h *Handler) SealHandler(w http.ResponseWriter, r *http.Request)

func (*Handler) SealStatusHandler

func (h *Handler) SealStatusHandler(w http.ResponseWriter, r *http.Request)

func (*Handler) SearchSecrets

func (h *Handler) SearchSecrets(w http.ResponseWriter, r *http.Request)

func (*Handler) Sign

func (h *Handler) Sign(w http.ResponseWriter, r *http.Request)

func (*Handler) UnsealHandler

func (h *Handler) UnsealHandler(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdatePath

func (h *Handler) UpdatePath(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateSecretMetadata

func (h *Handler) UpdateSecretMetadata(w http.ResponseWriter, r *http.Request)

func (*Handler) UserInGroup

func (h *Handler) UserInGroup(userID int64, groupName string) bool

func (*Handler) Verify

func (h *Handler) Verify(w http.ResponseWriter, r *http.Request)

type HmacRequest

type HmacRequest struct {
	KeyID   string `json:"key_id"`
	Message string `json:"message"`
}

type HmacResponse

type HmacResponse struct {
	HMAC string `json:"hmac"`
}

type HmacVerifyRequest

type HmacVerifyRequest struct {
	KeyID   string `json:"key_id"`
	Message string `json:"message"`
	HMAC    string `json:"hmac"`
}

type KeycloakAuthRequest

type KeycloakAuthRequest struct {
	IdToken      string `json:"idToken"`
	RefreshToken string `json:"refreshToken"`
	Token        string `json:"token"`
}

type LineageEdge

type LineageEdge struct {
	ID     string `json:"id"`
	Source string `json:"source"`
	Target string `json:"target"`
}

type LineageNode

type LineageNode struct {
	ID       string `json:"id"`
	Label    string `json:"label"`
	Type     string `json:"type"`
	ParentID string `json:"parent_id,omitempty"`
}

type LineageResponse

type LineageResponse struct {
	Nodes []LineageNode `json:"nodes"`
	Edges []LineageEdge `json:"edges"`
}

type PathResponse

type PathResponse struct {
	ID         string                 `json:"id"`
	Path       string                 `json:"path"`
	EngineType string                 `json:"engine_type"`
	Metadata   map[string]interface{} `json:"metadata"`
	CreatedBy  int64                  `json:"created_by"`
	CreatedAt  time.Time              `json:"created_at"`
	UpdatedAt  time.Time              `json:"updated_at"`
}

type SealRequest

type SealRequest struct {
	Shares []string `json:"shares"`
}

type SecretResponse

type SecretResponse struct {
	ID               string                 `json:"id"`
	PathID           string                 `json:"path_id"`
	Key              string                 `json:"key"`
	Version          int                    `json:"version"`
	Checksum         string                 `json:"checksum"`
	Metadata         map[string]interface{} `json:"metadata"`
	IsMultiValue     bool                   `json:"is_multi_value"`
	Tags             []string               `json:"tags"`
	CreatedAt        time.Time              `json:"created_at"`
	UpdatedAt        time.Time              `json:"updated_at"`
	IsOneTime        bool                   `json:"is_one_time"`
	ExpiresAt        *time.Time             `json:"expires_at,omitempty"`
	RotatedAt        *time.Time             `json:"rotated_at,omitempty"`
	RotationInterval string                 `json:"rotation_interval,omitempty"`
	LastRotatedAt    *time.Time             `json:"last_rotated_at,omitempty"`
	CreatedBy        string                 `json:"created_by"`
	Value            string                 `json:"value"`
	Path             string                 `json:"path"`
	KeyType          string                 `json:"key_type"`
	CreatedByUser    string                 `json:"created_by_user,omitempty"`
}

type SignRequest

type SignRequest struct {
	KeyID   string `json:"key_id"`
	Message string `json:"message"`
}

type SignResponse

type SignResponse struct {
	Signature string `json:"signature"`
}

type VerifyRequest

type VerifyRequest struct {
	KeyID     string `json:"key_id"`
	Message   string `json:"message"`
	Signature string `json:"signature"`
}

type VerifyResponse

type VerifyResponse struct {
	Verified bool `json:"verified"`
}

type WorkflowRequest

type WorkflowRequest struct {
	Event    map[string]interface{} `json:"event"`
	Workflow models.Workflow        `json:"workflow"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳