server

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClaims

func GetClaims(ctx context.Context) (*types.TokenClaims, bool)

GetClaims extracts OAuth claims from a request context

func HasScope

func HasScope(ctx context.Context, requiredScope string) bool

HasScope checks if the current request has a specific OAuth scope

func RequireScope

func RequireScope(scope string) func(http.Handler) http.Handler

RequireScope creates a middleware that requires a specific OAuth scope

Types

type OAuth2Server

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

OAuth2Server implements an OAuth 2.1 resource server

func NewOAuth2Server

func NewOAuth2Server(config *types.OAuth2Config, baseURL string, logger *logrus.Logger) (*OAuth2Server, error)

NewOAuth2Server creates a new OAuth 2.1 server

func (*OAuth2Server) AuthenticateRequest

func (s *OAuth2Server) AuthenticateRequest(ctx context.Context, r *http.Request) *types.AuthenticationResult

AuthenticateRequest authenticates an HTTP request using OAuth 2.1

func (*OAuth2Server) CreateMiddleware

func (s *OAuth2Server) CreateMiddleware() func(http.Handler) http.Handler

CreateMiddleware creates an HTTP middleware for OAuth 2.1 authentication

func (*OAuth2Server) RegisterHandlers

func (s *OAuth2Server) RegisterHandlers(mux *http.ServeMux)

RegisterHandlers registers OAuth 2.1 endpoints with an HTTP mux

Jump to

Keyboard shortcuts

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