Documentation
¶
Index ¶
- func GetAuthzDecision(ctx context.Context) any
- func GetPostPolicyPolicyB64(ctx context.Context) string
- func GetPreSignedExpiresAt(ctx context.Context) (any, bool)
- func GetUser(ctx context.Context) (*iam.User, error)
- func IsAnonymousRequest(ctx context.Context) bool
- func IsPostPolicyRequest(ctx context.Context) bool
- func IsPreSignedRequest(ctx context.Context) bool
- func WithAnonymousRequest(ctx context.Context) context.Context
- func WithAuthzDecision(ctx context.Context, decision any) context.Context
- func WithPostPolicyRequest(ctx context.Context, user *iam.User, policyB64 string) context.Context
- func WithPreSignedUser(ctx context.Context, user *iam.User, expiresAt any) context.Context
- func WithServiceAccountInfo(ctx context.Context, info *ServiceAccountInfo) context.Context
- func WithUser(ctx context.Context, user *iam.User) context.Context
- type KeyID
- type ServiceAccountInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthzDecision ¶
GetAuthzDecision extracts the authorization decision from the context
func GetPostPolicyPolicyB64 ¶
GetPostPolicyPolicyB64 returns the base64-encoded policy document from the POST policy form.
func GetPreSignedExpiresAt ¶
GetPreSignedExpiresAt returns the expiration time of the pre-signed URL
func IsAnonymousRequest ¶
IsAnonymousRequest returns true if the request was marked as anonymous
func IsPostPolicyRequest ¶
IsPostPolicyRequest returns true if request was authenticated via POST policy form upload.
func IsPreSignedRequest ¶
IsPreSignedRequest returns true if request was authenticated via pre-signed URL
func WithAnonymousRequest ¶
WithAnonymousRequest marks the request as anonymous in the context
func WithAuthzDecision ¶
WithAuthzDecision returns a new context with the authorization decision set
func WithPostPolicyRequest ¶
WithPostPolicyRequest adds a user authenticated via POST policy form upload to context. Also marks the request as a POST policy upload and stores the base64 policy for the handler.
func WithPreSignedUser ¶
WithPreSignedUser adds a user authenticated via pre-signed URL to context Also marks the request as pre-signed and stores expiration for auditing
func WithServiceAccountInfo ¶
func WithServiceAccountInfo(ctx context.Context, info *ServiceAccountInfo) context.Context
WithServiceAccountInfo returns a new context with service account metadata set.
Types ¶
type KeyID ¶
type KeyID string
const ( RequestUserKey KeyID = "requestUser" // RequestIDKey is the context key for request IDs RequestIDKey KeyID = "requestID" // RequestStartTimeKey is the context key for the request start timestamp RequestStartTimeKey KeyID = "requestStartTime" // TraceIDKey is the context key for trace IDs TraceIDKey KeyID = "traceID" // AuthzDecisionKey is the context key for the authorization decision // Set by authorization middleware, used for logging AuthzDecisionKey KeyID = "authzDecision" // IsAnonymousRequestKey marks a request as explicitly anonymous // Set by auth middleware when no Authorization header is present IsAnonymousRequestKey KeyID = "isAnonymousRequest" // IsPreSignedRequestKey marks a request authenticated via pre-signed URL // Set by auth middleware when request uses query-based authentication IsPreSignedRequestKey KeyID = "isPreSignedRequest" // PreSignedExpiresAtKey stores the expiration time of the pre-signed URL // Used for auditing and logging purposes PreSignedExpiresAtKey KeyID = "preSignedExpiresAt" // ServiceAccountInfoKey holds service account metadata for policy evaluation. // Set by auth middleware when the authenticated access key belongs to a service account. ServiceAccountInfoKey KeyID = "serviceAccountInfo" // IsPostPolicyRequestKey marks a request authenticated via POST policy form upload. // Set by auth middleware when request uses multipart/form-data with a policy field. IsPostPolicyRequestKey KeyID = "isPostPolicyRequest" // PostPolicyPolicyB64Key stores the base64-encoded policy document from the form. // Used by the PostObject handler to validate conditions. PostPolicyPolicyB64Key KeyID = "postPolicyPolicyB64" )
type ServiceAccountInfo ¶
type ServiceAccountInfo struct {
ParentUserUUID *uuid.UUID // UUID of the parent user (nil if no parent)
PolicyMode iam.PolicyMode // "inherit" or "override" (empty = inherit)
EmbeddedPolicyJSON string // raw IAM policy JSON; used directly in override mode
}
ServiceAccountInfo holds service account metadata used by the policy engine to resolve effective IAM policies at evaluation time.
func GetServiceAccountInfo ¶
func GetServiceAccountInfo(ctx context.Context) *ServiceAccountInfo
GetServiceAccountInfo extracts service account metadata from the context. Returns nil if the request was not made by a service account.