router

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntrospectionResponse

type IntrospectionResponse struct {
	Active    bool   `json:"active"`
	ClientID  string `json:"client_id"`
	Username  string `json:"username,omitempty"`
	Scope     string `json:"scope,omitempty"`
	Exp       int64  `json:"exp,omitempty"`
	TokenType string `json:"token_type,omitempty"`
}

IntrospectionResponse models what most OAuth2 servers return at /introspect

type IntrospectionTokenStore

type IntrospectionTokenStore struct {
	IntrospectURL string
	ClientID      string
	ClientSecret  string
	HTTPClient    *http.Client
}

IntrospectionTokenStore implements oauth2.TokenStore by calling /introspect

func NewIntrospectionTokenStore

func NewIntrospectionTokenStore(url, clientID, clientSecret string) *IntrospectionTokenStore

func (*IntrospectionTokenStore) Create

func (s *IntrospectionTokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error

func (*IntrospectionTokenStore) GetByAccess

func (s *IntrospectionTokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)

GetByAccess calls the introspection endpoint and, if active, returns a TokenInfo

func (*IntrospectionTokenStore) GetByCode

func (s *IntrospectionTokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)

func (*IntrospectionTokenStore) GetByRefresh

func (s *IntrospectionTokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)

func (*IntrospectionTokenStore) RemoveByAccess

func (s *IntrospectionTokenStore) RemoveByAccess(ctx context.Context, access string) error

We don’t need refresh tokens here.

func (*IntrospectionTokenStore) RemoveByCode

func (s *IntrospectionTokenStore) RemoveByCode(ctx context.Context, code string) error

func (*IntrospectionTokenStore) RemoveByRefresh

func (s *IntrospectionTokenStore) RemoveByRefresh(ctx context.Context, refresh string) error

type RouteHandler

type RouteHandler interface {
	RegisterRoutes(controllers []controller.Controller)
	RegisterRoute(controller controller.Controller)
	GetEngine() *gin.Engine
	EnableAuth(introspectURL string, clientId string, clientSecret string) error
	AllowCORS()
	EnableSentry(dsn string)
}

func NewRouteHandler

func NewRouteHandler(baseUrl string) (RouteHandler, error)

type Router

type Router struct {
	// contains filtered or unexported fields
}

func (*Router) AllowCORS

func (r *Router) AllowCORS()

func (*Router) EnableAuth

func (r *Router) EnableAuth(introspectURL string, clientId string, clientSecret string) error

func (*Router) EnableSentry

func (r *Router) EnableSentry(dsn string)

func (*Router) GetEngine

func (r *Router) GetEngine() *gin.Engine

func (*Router) RegisterRoute

func (r *Router) RegisterRoute(cnt controller.Controller)

func (*Router) RegisterRoutes

func (r *Router) RegisterRoutes(controllers []controller.Controller)

Jump to

Keyboard shortcuts

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