Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaimsFromContext
deprecated
ClaimsFromContext returns legacy TokenSmith JWT claims stored in request context.
Deprecated: new services should prefer mapping verified claims into an authz.Principal and storing it using tokensmith.SetPrincipal, then use tokensmith.PrincipalFromContext.
func PrincipalFromContext ¶
PrincipalFromContext returns the authorization principal stored in ctx.
Compatibility strategy (read-new then read-old):
- If a *authz.Principal was stored using tokensmith.SetPrincipal, return it.
- Else, if legacy JWT claims exist in ctx under the legacy key, derive a minimal principal from those claims.
Legacy-derived principal mapping:
- ID: claims.Subject
- Roles: claims.Scope
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tokenservice
command
|
|
|
example
|
|
|
serviceauth
command
|
|
|
examples
|
|
|
minisvc
command
minisvc is a small demonstration service showing how to wire TokenSmith AuthN (JWT) + AuthZ (Casbin) middleware.
|
minisvc is a small demonstration service showing how to wire TokenSmith AuthN (JWT) + AuthZ (Casbin) middleware. |
|
internal
|
|
|
casbinfuncs
Package casbinfuncs provides a centralized registry of Casbin matcher functions used by TokenSmith model presets.
|
Package casbinfuncs provides a centralized registry of Casbin matcher functions used by TokenSmith model presets. |
|
middleware
module
|
|
|
pkg
|
|
|
authz
Package authz provides a normative authorization contract and core types used by OpenCHAMI services integrating TokenSmith.
|
Package authz provides a normative authorization contract and core types used by OpenCHAMI services integrating TokenSmith. |
|
authz/chi
Package chi provides chi-specific authorization middleware and route helpers implementing the TokenSmith AuthZ contract.
|
Package chi provides chi-specific authorization middleware and route helpers implementing the TokenSmith AuthZ contract. |
|
authz/engine
Package engine constructs a Casbin-backed Authorizer.
|
Package engine constructs a Casbin-backed Authorizer. |
|
authz/policyloader
Package policyloader loads Casbin model and policy artifacts (policy + grouping fragments) deterministically.
|
Package policyloader loads Casbin model and policy artifacts (policy + grouping fragments) deterministically. |
|
authz/presets
Package presets provides convenience Casbin model presets.
|
Package presets provides convenience Casbin model presets. |
|
testutil
Package testutil provides helpers for integration tests in downstream OpenCHAMI services.
|
Package testutil provides helpers for integration tests in downstream OpenCHAMI services. |
|
token
Package token defines types and utilities for JWT-based authentication in microservices.
|
Package token defines types and utilities for JWT-based authentication in microservices. |
Click to show internal directories.
Click to hide internal directories.