Documentation ¶
Index ¶
- Variables
- func AllProjectsRequested(projectsFilter []string) bool
- func ContextWithoutProjects(ctx context.Context) context.Context
- func FromIncomingMetadata(ctx context.Context) context.Context
- func NewContext(ctx context.Context, subs []string, projects []string, res, act, pol string) context.Context
- func NewOutgoingContext(ctx context.Context) context.Context
- func NewOutgoingProjectsContext(ctx context.Context) context.Context
- func PolicyVersion(ctx context.Context) (pol string)
- func ProjectsFromIncomingContext(ctx context.Context) ([]string, error)
- func Subjects(ctx context.Context) (subs []string)
- type Properties
Constants ¶
This section is empty.
Variables ¶
var (
// Must match authz-service/../constants.go#AllProjectsExternalID
AllProjectsKey = "*"
)
var (
ErrParseAuthContext = errors.New("could not parse auth context")
)
Functions ¶
func AllProjectsRequested ¶
AllProjectsRequested takes in the project filter list and returns true if the list is a single entry of *.
func ContextWithoutProjects ¶
ContextWithoutProjects removes previously added projects from the GRPC metadata for those system operations that must not be filtered by projects.
func FromIncomingMetadata ¶
FromIncomingMetadata translates auth info provided by GRPC metadata into auth_context's representation, to be retrieved via auth_context.FromContext.
func NewContext ¶
func NewContext(ctx context.Context, subs []string, projects []string, res, act, pol string) context.Context
NewContext returns a new `context.Context` that holds a reference to the provided properties
func NewOutgoingContext ¶
NewOutgoingContext translates previously injected auth_context info into GRPC metadata, to be consumed by the downstream service.
func NewOutgoingProjectsContext ¶
NewOutgoingProjectsContext translates previously injected auth_context info into GRPC metadata, to be consumed by the downstream service, but only for projects.
func PolicyVersion ¶
PolicyVersion returns the auth policy version associated with `ctx`, or "" if it could not be found.
func ProjectsFromIncomingContext ¶
ProjectsFromIncomingContext parses the projects from the incoming request context. It throws an error if there is an issue parsing the context.
Types ¶
type Properties ¶
type Properties struct { Subjects []string Projects []string Resource string Action string PolicyVersion string }
Properties is a container for metadata available from the context.
func FromContext ¶
func FromContext(ctx context.Context) *Properties
FromContext returns the auth data previously associated with `ctx`, or `nil` or "" if a piece of the information could not be found.