auth

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CavConfineUser         = macaroon.CavAuthConfineUser
	CavConfineOrganization = macaroon.CavAuthConfineOrganization
	CavConfineGoogleHD     = macaroon.CavAuthConfineGoogleHD
	CavConfineGitHubOrg    = macaroon.CavAuthConfineGitHubOrg
	CavMaxValidity         = macaroon.CavAuthMaxValidity
)

Variables

This section is empty.

Functions

func GetMaxValidity

func GetMaxValidity(cs *macaroon.CaveatSet) (time.Duration, bool)

Types

type ConfineGitHubOrg

type ConfineGitHubOrg uint64

Implements macaroon.Caveat and error. Requires that the user is authenticated to GitHub with an account that has access the specified org.

func RequireGitHubOrg

func RequireGitHubOrg(id uint64) *ConfineGitHubOrg

func (*ConfineGitHubOrg) CaveatType

func (c *ConfineGitHubOrg) CaveatType() macaroon.CaveatType

func (*ConfineGitHubOrg) Error

func (c *ConfineGitHubOrg) Error() string

implements error

func (*ConfineGitHubOrg) Name

func (c *ConfineGitHubOrg) Name() string

func (*ConfineGitHubOrg) Prohibits

func (c *ConfineGitHubOrg) Prohibits(a macaroon.Access) error

Implements macaroon.Caveat

type ConfineGoogleHD

type ConfineGoogleHD string

Implements macaroon.Caveat and error. Requires that the user is authenticated to Google with an account in the specified HD.

func RequireGoogleHD

func RequireGoogleHD(hd string) *ConfineGoogleHD

func (*ConfineGoogleHD) CaveatType

func (c *ConfineGoogleHD) CaveatType() macaroon.CaveatType

func (*ConfineGoogleHD) Error

func (c *ConfineGoogleHD) Error() string

implements error

func (*ConfineGoogleHD) Name

func (c *ConfineGoogleHD) Name() string

func (*ConfineGoogleHD) Prohibits

func (c *ConfineGoogleHD) Prohibits(a macaroon.Access) error

Implements macaroon.Caveat

type ConfineOrganization

type ConfineOrganization struct {
	ID uint64 `json:"id"`
}

ConfineOrganization is a requirement placed on 3P caveats, requiring that the authenticated used be associated with OrgID. It has no meaning in a 1P setting.

func RequireOrganization

func RequireOrganization(id uint64) *ConfineOrganization

func (*ConfineOrganization) CaveatType

func (c *ConfineOrganization) CaveatType() macaroon.CaveatType

func (*ConfineOrganization) Error

func (c *ConfineOrganization) Error() string

implements error

func (*ConfineOrganization) Name

func (c *ConfineOrganization) Name() string

func (*ConfineOrganization) Prohibits

func (c *ConfineOrganization) Prohibits(a macaroon.Access) error

Implements macaroon.Caveat

type ConfineUser

type ConfineUser struct {
	ID uint64 `json:"id"`
}

ConfineUser is a caveat limiting this token to a specific user ID.

func RequireUser

func RequireUser(id uint64) *ConfineUser

func (*ConfineUser) CaveatType

func (c *ConfineUser) CaveatType() macaroon.CaveatType

func (*ConfineUser) Error

func (c *ConfineUser) Error() string

implements error

func (*ConfineUser) Name

func (c *ConfineUser) Name() string

func (*ConfineUser) Prohibits

func (c *ConfineUser) Prohibits(a macaroon.Access) error

Implements macaroon.Caveat

type DischargeRequest

type DischargeRequest struct {
	User         *UserAuth
	Organization *OrganizationAuth
	Google       *GoogleAuth
	GitHub       *GitHubAuth
	Expiry       time.Time
}

implements macaroon.Access

func (*DischargeRequest) Now

func (a *DischargeRequest) Now() time.Time

func (*DischargeRequest) Validate

func (a *DischargeRequest) Validate() error

type GitHubAuth

type GitHubAuth struct {
	OrgIDs []uint64
}

type GoogleAuth

type GoogleAuth struct {
	HD string
}

type MaxValidity

type MaxValidity uint64

Implements macaroon.Caveat. Limits the validity window length (seconds) of discharges issued by 3ps.

func (*MaxValidity) CaveatType

func (c *MaxValidity) CaveatType() macaroon.CaveatType

func (*MaxValidity) Name

func (c *MaxValidity) Name() string

func (*MaxValidity) Prohibits

func (c *MaxValidity) Prohibits(a macaroon.Access) error

Implements macaroon.Caveat

type OrganizationAuth

type OrganizationAuth struct {
	IDs []uint64
}

type UserAuth

type UserAuth struct {
	ID uint64
}

Jump to

Keyboard shortcuts

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