acpauth

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package acpauth defines bearer-token authorization for ACP HTTP handlers.

Implement Authorizer to connect a handler to production authentication. StaticTokenAuthorizer is intended for examples, tests, and other cases where one fixed token is sufficient.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	Authorize(ctx context.Context, bearer string) error
}

Authorizer validates a bearer token extracted from the Authorization header. The token does not include the "Bearer" scheme prefix.

func StaticTokenAuthorizer

func StaticTokenAuthorizer(token string) Authorizer

StaticTokenAuthorizer returns an Authorizer that accepts exactly token.

Example
package main

import (
	"context"
	"fmt"

	"github.com/sumup/acp/acpauth"
)

func main() {
	authorizer := acpauth.StaticTokenAuthorizer("api_key_123")

	err := authorizer.Authorize(context.Background(), "api_key_123")
	fmt.Println(err)
}
Output:
<nil>

type AuthorizerFunc

type AuthorizerFunc func(ctx context.Context, bearer string) error

AuthorizerFunc lifts bare functions into Authorizer.

func (AuthorizerFunc) Authorize

func (f AuthorizerFunc) Authorize(ctx context.Context, bearer string) error

Authorize validates bearer using the wrapped function.

Jump to

Keyboard shortcuts

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