Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthServer ¶
type AuthServer struct {
// Config holds the OAuth2 protection settings; use Global or Tools for spec-based or experimental modes.
Config *authorization.Config
//if this option is set, server will start oauth 2.1 flow itself (for case we want flexibility with stdio server)
RoundTripper *transport.RoundTripper
}
AuthServer acts as a broker between clients and external OAuth2/OIDC providers.
func MustNewAuthServer ¶
func MustNewAuthServer(config *authorization.Config) *AuthServer
MustNewAuthServer creates an AuthServer or panics if configuration is invalid.
func NewAuthServer ¶
func NewAuthServer(config *authorization.Config) (*AuthServer, error)
NewAuthServer initializes an AuthServer with the given configuration.
func (*AuthServer) EnsureAuthorized ¶
func (s *AuthServer) EnsureAuthorized(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*authschema.Token, error)
EnsureAuthorized checks if a request is authorized.
func (*AuthServer) Middleware ¶
func (s *AuthServer) Middleware(next http.Handler) http.Handler
Middleware wraps a handler to enforce bearer-token authorization.
func (*AuthServer) RegisterHandlers ¶
func (s *AuthServer) RegisterHandlers(mux *http.ServeMux)
RegisterHandlers registers HTTP handlers for OAuth2 endpoints onto the given ServeMux.
type Authorizer ¶
type Authorizer func(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*authschema.Token, error)
Authorizer is an interceptor function for JSON-RPC calls that returns a Token when authorization is successful or nil otherwise.
type FallbackAuth ¶
type FallbackAuth struct {
Strict *AuthServer
TokenSource authorization.ProtectedResourceTokenSource
IdTokenSource authorization.IdTokenSource
}
FallbackAuth is a fallback authorization interceptor
func NewFallbackAuth ¶
func NewFallbackAuth(authServer *AuthServer, tokenSource authorization.ProtectedResourceTokenSource, idTokenSource authorization.IdTokenSource) *FallbackAuth
func (*FallbackAuth) EnsureAuthorized ¶
func (a *FallbackAuth) EnsureAuthorized(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*authorization.Token, error)
Click to show internal directories.
Click to hide internal directories.