auth

package
v3.15.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithSchemes added in v3.15.1

func WithSchemes(ctx context.Context, schemes []Scheme) context.Context

WithSchemes carries the schemes an HTTP server accepts. A service that describes that server's API reads them from its context instead of being configured with them a second time, so what a deployment publishes cannot disagree with what it accepts.

Types

type Cacheable added in v3.14.0

type Cacheable interface {
	Cacheable() bool
}

Cacheable is implemented by a Manager or a CredentialStrategy whose outcome depends on the credential alone, so it may be cached. Without it nothing is cached: a public link, for example, follows the current share permissions.

type CredentialStrategy

type CredentialStrategy interface {
	GetCredentials(w http.ResponseWriter, r *http.Request) (*Credentials, error)
	AddWWWAuthenticate(w http.ResponseWriter, r *http.Request, realm string)
}

CredentialStrategy obtains Credentials from the request.

type Credentials

type Credentials struct {
	Type         string
	ClientID     string
	ClientSecret string
}

Credentials contains the auth type, client id and secret.

type Manager

type Manager interface {
	Authenticate(ctx context.Context, clientID, clientSecret string) (*user.User, map[string]*authpb.Scope, error)
}

Manager is the interface to implement to authenticate users.

type Registry

type Registry interface {
	ListProviders(ctx context.Context) ([]*registry.ProviderInfo, error)
	GetProvider(ctx context.Context, authType string) (*registry.ProviderInfo, error)
}

Registry is the interface that auth registries implement for discovering auth providers.

type Scheme added in v3.15.1

type Scheme struct {
	// Name identifies the scheme to a client, after the strategy that accepts
	// it.
	Name string
	// Kind is where the credential goes.
	Kind SchemeKind
	// Param names the header or query parameter, for the kinds that use one.
	Param string
	// Description is addressed to whoever has to authenticate.
	Description string
}

Scheme is one way of authenticating that a server accepts. A server is configured with chains of strategies, which is how it reads a request; a Scheme is that same arrangement turned around, to tell a client what to send.

func SchemesFromContext added in v3.15.1

func SchemesFromContext(ctx context.Context) []Scheme

SchemesFromContext returns the schemes WithSchemes carried, and nil if nothing did.

type SchemeKind added in v3.15.1

type SchemeKind string

SchemeKind is where on the wire a credential goes.

const (
	// SchemeBasic is HTTP basic authentication.
	SchemeBasic SchemeKind = "basic"
	// SchemeBearer is a token in the Authorization header, "Bearer" prefixed.
	SchemeBearer SchemeKind = "bearer"
	// SchemeNegotiate is a SPNEGO token in the Authorization header, as RFC
	// 4559 negotiates it.
	SchemeNegotiate SchemeKind = "negotiate"
	// SchemeHeader is a token in a header of its own.
	SchemeHeader SchemeKind = "header"
	// SchemeQuery is a token in a query parameter.
	SchemeQuery SchemeKind = "query"
)

type SignedURLStrategy added in v3.4.0

type SignedURLStrategy interface {
	Authenticate(r *http.Request) (*http.Request, bool)
}

type TokenStrategy

type TokenStrategy interface {
	GetToken(r *http.Request) string
}

TokenStrategy obtains a token from the request. If token does not exist returns an empty string.

type TokenWriter

type TokenWriter interface {
	WriteToken(token string, w http.ResponseWriter)
}

TokenWriter stores the token in a http response.

Directories

Path Synopsis
Package cache memoizes the outcome of verifying a credential.
Package cache memoizes the outcome of verifying a credential.
manager
kerberos
Package kerberos authenticates a user from a Kerberos ticket, so that a client holding a TGT can reach reva directly without an intermediate identity provider.
Package kerberos authenticates a user from a Kerberos ticket, so that a client holding a TGT can reach reva directly without an intermediate identity provider.
ocmexchangedtoken
Package ocmexchangedtoken validates exchanged JWTs for OCM DAV access.
Package ocmexchangedtoken validates exchanged JWTs for OCM DAV access.
ocmsharecode
Package ocmsharecode validates OCM exchange codes for the /ocm/token endpoint.
Package ocmsharecode validates OCM exchange codes for the /ocm/token endpoint.
oidc
Package oidc verifies an OIDC token against the configured OIDC provider and obtains the necessary claims to obtain user information.
Package oidc verifies an OIDC token against the configured OIDC provider and obtains the necessary claims to obtain user information.
ocmshare
Package ocmshare reads code-flow OCM share scopes without importing the parent scope package or the JWT token manager.
Package ocmshare reads code-flow OCM share scopes without importing the parent scope package or the JWT token manager.

Jump to

Keyboard shortcuts

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