macaroon_security

package module
v0.0.0-...-d30e3bf Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthDatabase    = "local"
	KeyPairFileName = "keyMacaroon.json"
)

Variables

This section is empty.

Functions

func ValidationCaveat

func ValidationCaveat(macaroon *bakery.Macaroon, validation string) bool

func ValidationCaveatDate

func ValidationCaveatDate(cavString string) bool

Types

type IMacaroonSecurity

type IMacaroonSecurity interface {
	CreateRequest(requestValidator MacaroonRequest) (*bakery.Macaroon, error)
	ReadResource(jsonData []byte) ([]bakery.Op, []string, error)
	ModifyMaroon(jsonData []byte) ([]byte, error)
}

func Initialize

func Initialize(mongoURI string) IMacaroonSecurity

type MacaroonCaveatRequest

type MacaroonCaveatRequest struct {
	Macaroon string `json:"macaroon"`
	Caveat   string `json:"caveat"`
}

type MacaroonRequest

type MacaroonRequest struct {
	Sender     string
	Ressources []ResourceRequest
}

type MacaroonSecurityService

type MacaroonSecurityService struct {
	Oven    *bakery.Oven
	KeyPair *bakery.KeyPair
}

func (*MacaroonSecurityService) CreateRequest

func (mss *MacaroonSecurityService) CreateRequest(requestValidator MacaroonRequest) (*bakery.Macaroon, error)

CreateRequest create a Macaroon from the given MacaroonRequest

func (*MacaroonSecurityService) ModifyMaroon

func (mss *MacaroonSecurityService) ModifyMaroon(jsonData []byte) ([]byte, error)

func (*MacaroonSecurityService) ReadResource

func (mss *MacaroonSecurityService) ReadResource(jsonData []byte) ([]bakery.Op, []string, error)

ReadResource parse the Json Base64 encoded, check the Macaroon, and return the Op inside

type ResourceRequest

type ResourceRequest struct {
	Action   string
	File     string
	Duration string
}

Jump to

Keyboard shortcuts

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