scope

package
v3.12.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const MachineScope = "machine"

MachineScope marks a token minted through machine authentication. Machine auth is otherwise indistinguishable from a normal owner-scoped user token, so this marker lets privileged internal RPCs (for example gateway PublishEvent) verify that the caller is a reva daemon holding the machine secret.

Variables

This section is empty.

Functions

func AddCodeFlowOCMShareScope added in v3.9.0

func AddCodeFlowOCMShareScope(share *ocmv1beta1.Share, role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddCodeFlowOCMShareScope adds a shareId/resource-only scope used by code-flow exchanged JWTs. Unlike AddOCMShareScope, it deliberately omits Token so the long-lived shared secret is never embedded in exchanged-token scopes.

func AddLightweightAccountScope

func AddLightweightAccountScope(role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddLightweightAccountScope adds the scope to allow access to lightweight user.

func AddMachineScope added in v3.12.0

func AddMachineScope(scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddMachineScope adds the machine-auth marker scope. It only records that the token was issued via machine auth; resource access still comes from the other scopes on the token.

func AddOCMShareScope

func AddOCMShareScope(share *ocmv1beta1.Share, role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddOCMShareScope adds the scope to allow access to an OCM share and the share resource. It carries the share metadata needed to resolve authenticated DAV requests without a second repository lookup, including Token for backward compatibility with legacy direct-secret flows.

func AddOwnerScope

func AddOwnerScope(scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddOwnerScope adds the default owner scope with access to all resources.

func AddPublicShareScope

func AddPublicShareScope(share *link.PublicShare, role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddPublicShareScope adds the scope to allow access to a public share and the shared resource.

func AddReceivedShareScope

func AddReceivedShareScope(share *collaboration.ReceivedShare, role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddReceivedShareScope adds the scope to allow access to a received user/group share and the shared resource.

func AddResourceInfoScope

func AddResourceInfoScope(r *provider.ResourceInfo, role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddResourceInfoScope adds the scope to allow access to a resource info object.

func AddShareScope

func AddShareScope(share *collaboration.Share, role authpb.Role, scopes map[string]*authpb.Scope) (map[string]*authpb.Scope, error)

AddShareScope adds the scope to allow access to a user/group share and the shared resource.

func ContextWithMachineScope added in v3.12.0

func ContextWithMachineScope(ctx context.Context) (context.Context, error)

ContextWithMachineScope re-signs the caller's token with the machine (reva daemon) scope added, keeping the acting user and any existing scopes unchanged. It lets a reva service call daemon-only RPCs as the real user in the context, without impersonating anyone. The new token is signed with the shared JWT secret, which only reva services hold, so an end user cannot mint one themselves. Returns a context carrying the re-signed token.

func FormatScope

func FormatScope(scopeType string, scope *authpb.Scope) (string, error)

FormatScope create a pretty print of the scope.

func GetOCMSharesFromScopes

func GetOCMSharesFromScopes(scopes map[string]*authpb.Scope) ([]*ocmv1beta1.Share, error)

GetOCMSharesFromScopes returns all OCM shares in the given scope.

func GetPublicSharesFromScopes

func GetPublicSharesFromScopes(scopes map[string]*authpb.Scope) ([]*link.PublicShare, error)

GetPublicSharesFromScopes returns all public shares in the given scope.

func VerifyScope

func VerifyScope(ctx context.Context, scopeMap map[string]*authpb.Scope, resource any) (bool, error)

VerifyScope is the function to be called when dismantling tokens to check if the token has access to a particular resource.

Types

type Verifier

type Verifier func(context.Context, *authpb.Scope, any, *zerolog.Logger) (bool, error)

Verifier is the function signature which every scope verifier should implement.

Jump to

Keyboard shortcuts

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