middlewares

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package middlewares provides a set of middleware functions used to check Zitadel access token for auth and roles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ZitadelAuth

type ZitadelAuth struct {
	Domain string // Zitadel instance domain
	Key    string // path to key.json
	AuthZ  *authorization.Authorizer[*oauth.IntrospectionContext]
}

ZitadelAuth holds the configuration for Zitadel and the Authorizer

func NewZitadelAuth

func NewZitadelAuth(conf config.Config) ZitadelAuth

NewZitadelAuth creates a new ZitadelAuth object with the given configuration. It sets up the Zitadel SDK with the given domain and key path.

func (*ZitadelAuth) AllowAnyOfRoles

func (za *ZitadelAuth) AllowAnyOfRoles(next http.Handler, roles ...string) http.Handler

AllowAnyOfRoles middleware checks if the given request has a valid access token and if the user has any of the given roles.

func (*ZitadelAuth) AllowAuthenticated

func (za *ZitadelAuth) AllowAuthenticated(next http.Handler) http.Handler

AllowAuthenticated middleware checks if the given request has a valid acess token.

Jump to

Keyboard shortcuts

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