contract

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceSecurityContext = "service.security.context"

	EventSecurityAuthorizationGranted = "security.authorization.granted"
	EventSecurityAuthorizationDenied  = "security.authorization.denied"

	EventSecurityLoginSuccess = "security.login.success"
	EventSecurityLoginFailure = "security.login.failure"

	EventSecurityLogoutSuccess = "security.logout.success"
	EventSecurityLogoutFailure = "security.logout.failure"

	AttributePublicAccess = "PUBLIC_ACCESS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessDecisionManager

type AccessDecisionManager interface {
	DecideAll(token Token, attributes []string, subject any) error

	DecideAny(token Token, attributes []string, subject any) error
}

type AccessDeniedHandler

type AccessDeniedHandler interface {
	Handle(runtimeInstance runtimecontract.Runtime, request httpcontract.Request, decisionErr error) (httpcontract.Response, error)
}

type Authenticator

type Authenticator interface {
	Supports(request httpcontract.Request) bool

	Authenticate(request httpcontract.Request) (Token, error)
}

type DecisionStrategy

type DecisionStrategy int
const (
	DecisionStrategyAffirmative DecisionStrategy = iota
	DecisionStrategyConsensus
	DecisionStrategyUnanimous
)

type EntryPoint

type EntryPoint interface {
	Start(runtimeInstance runtimecontract.Runtime, request httpcontract.Request) (httpcontract.Response, error)
}

type Firewall

type Firewall interface {
	Name() string

	LoginPath() string

	LogoutPath() string

	Login(
		runtimeInstance runtimecontract.Runtime,
		request httpcontract.Request,
		input LoginInput,
	) (*LoginResult, error)

	Logout(
		runtimeInstance runtimecontract.Runtime,
		request httpcontract.Request,
		input LogoutInput,
	) (*LogoutResult, error)
}

type FirewallManager

type FirewallManager interface {
	Firewall(name string) (Firewall, error)
}

type LoginHandler

type LoginHandler interface {
	Login(runtimeInstance runtimecontract.Runtime, request httpcontract.Request, input LoginInput) (*LoginResult, error)
}

type LoginInput

type LoginInput struct {
	Token Token
}

type LoginResult

type LoginResult struct {
	Token    Token
	Response httpcontract.Response
}

type LogoutHandler

type LogoutHandler interface {
	Logout(runtimeInstance runtimecontract.Runtime, request httpcontract.Request, input LogoutInput) (*LogoutResult, error)
}

type LogoutInput

type LogoutInput struct{}

type LogoutResult

type LogoutResult struct {
	Response httpcontract.Response
}

type Matcher

type Matcher interface {
	Matches(request httpcontract.Request) bool
}

type Rule

type Rule interface {
	Applies(request httpcontract.Request) bool

	Check(request httpcontract.Request) error
}

type Token

type Token interface {
	IsAuthenticated() bool

	UserIdentifier() string

	Roles() []string
}

type TokenResolver

type TokenResolver func(request httpcontract.Request) Token

type TokenSource

type TokenSource interface {
	Name() string

	Resolve(runtimeInstance runtimecontract.Runtime, request httpcontract.Request) (Token, error)
}

type VoteResult

type VoteResult int
const (
	VoteAbstain VoteResult = iota
	VoteDenied
	VoteGranted
)

type Voter

type Voter interface {
	Supports(attribute string, subject any) bool

	Vote(token Token, attribute string, subject any) VoteResult
}

Jump to

Keyboard shortcuts

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