auth

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditInterceptor

func AuditInterceptor(log *logger.Logger) grpc.UnaryServerInterceptor

AuditInterceptor runs after authentication; rejected authentication is recorded by Authentication.Interceptor instead.

func EventWriteInterceptor

func EventWriteInterceptor(tasks tesrpc.TaskServiceServer) grpc.UnaryServerInterceptor

EventWriteInterceptor checks that event writes target accessible tasks.

Types

type Authentication

type Authentication struct {
	// contains filtered or unexported fields
}

func NewAuthentication

func NewAuthentication(
	creds []*config.BasicCredential,
	oidc *config.OidcAuth,
	taskAccess string,
	log *logger.Logger,
) *Authentication

func (*Authentication) EchoTokenHandler

func (a *Authentication) EchoTokenHandler(w http.ResponseWriter, req *http.Request)

HTTP request handler for the /login/token endpoint. In case of OIDC enabled, prints the JWT from the sent cookie. In all other cases, an empty HTTP 200 response.

func (*Authentication) Interceptor

func (a *Authentication) Interceptor(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (interface{}, error)

Return a new gRPC interceptor function that authorizes RPCs.

func (*Authentication) LoginHandler

func (a *Authentication) LoginHandler(w http.ResponseWriter, req *http.Request)

HTTP request handler for the /login endpoint. Initiates user authentication flow based on the configuration (OIDC, Basic, none).

type IntrospectionResponse

type IntrospectionResponse struct {
	Active bool `json:"active"`
}

JSON structure of the OIDC token introspection response (only some fields)

type OidcConfig

type OidcConfig struct {
	// contains filtered or unexported fields
}

OIDC configuration structure used for validating input from request.

func (*OidcConfig) Authorize

func (c *OidcConfig) Authorize(authorization string) *identity.UserInfo

func (*OidcConfig) EchoTokenHandler

func (c *OidcConfig) EchoTokenHandler(w http.ResponseWriter, req *http.Request)

Prints the JWT from the cookie value in the response body. Missing cookie value results in HTTP 404 response. Frontend uses this endpoint for fetching the JWT for performing API requests. Frontend cannot access the cookie directly as it is HttpOnly. Although the API could also obtain the JWT from the cookie, it would be harder to maintain, especially in the gRPC code. Therefore, the frontend uses this login-token endpoint to establish JWT first, and then provide the JWT value in the Authorization header of API requests.

func (*OidcConfig) HandleAuthCode

func (c *OidcConfig) HandleAuthCode(w http.ResponseWriter, req *http.Request)

func (*OidcConfig) ParseJwtSubject

func (c *OidcConfig) ParseJwtSubject(jwtString string) string

func (*OidcConfig) RedirectToLogin

func (c *OidcConfig) RedirectToLogin(w http.ResponseWriter, req *http.Request)

type OidcRemoteConfig

type OidcRemoteConfig struct {
	Issuer                string `json:"issuer"`
	JwksURI               string `json:"jwks_uri"`
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	IntrospectionEndpoint string `json:"introspection_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
}

JSON structure of the OIDC configuration (only some fields)

Jump to

Keyboard shortcuts

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