iammiddleware

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package iammiddleware provides Gin middleware for validating Hanzo IAM (hanzo.id) JWT tokens. It uses the existing auth.IAMClient for JWKS-based token validation and sets IAM claims in the Gin context for downstream handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIAMClaims

func GetIAMClaims(c *gin.Context) *auth.IAMClaims

GetIAMClaims returns the IAM claims from context, or nil if not IAM-authenticated.

func IAMTokenRequired

func IAMTokenRequired() gin.HandlerFunc

IAMTokenRequired validates hanzo.id JWT tokens via JWKS. If a valid IAM token is found, it resolves the org from the token's "owner" claim and sets both IAM context keys and the standard "organization" + "permissions" keys that downstream handlers expect. If no Bearer token is present or validation fails, it falls through to the next middleware (legacy org-token auth) without aborting.

func Init

func Init(cfg *auth.IAMConfig) error

Init initializes the IAM middleware with the given configuration. Must be called before IAMTokenRequired() middleware is used. Safe to call multiple times; last call wins.

func IsIAMAuthenticated

func IsIAMAuthenticated(c *gin.Context) bool

IsIAMAuthenticated checks whether the current request was authenticated via IAM.

Types

This section is empty.

Jump to

Keyboard shortcuts

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