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 ¶
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 ¶
AuthorizerFunc lifts bare functions into Authorizer.
Click to show internal directories.
Click to hide internal directories.