harness

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package harness provides RBAC/ABAC test helpers for downstream services that consume the generated API. It builds signed HS256 tokens with chosen roles, scopes, and attributes and the matching bearer headers so handler authorization can be exercised in unit and integration tests. Code generated by apic; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerHeader

func BearerHeader(token string) string

BearerHeader returns a standard Authorization header value.

func BuildHS256Token

func BuildHS256Token(secret []byte, claims JWTClaims) (string, error)

BuildHS256Token returns a signed HS256 JWT suitable for securex verifier tests.

Types

type JWTClaims

type JWTClaims struct {
	Subject    string            `json:"sub,omitempty"`
	Roles      []string          `json:"roles,omitempty"`
	Scopes     []string          `json:"scopes,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
	IssuedAt   int64             `json:"iat,omitempty"`
	NotBefore  int64             `json:"nbf,omitempty"`
	ExpiresAt  int64             `json:"exp,omitempty"`
}

JWTClaims is a minimal claim-set used by auth tests.

Jump to

Keyboard shortcuts

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