oauthscope

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package oauthscope is the single definition of the OAuth scopes this platform issues and enforces.

It exists because the two discovery documents used to disagree - the authorization server advertised {openid, profile, email, mcp} while the protected resource advertised {mcp, mcp_read, mcp_write} - and nothing anywhere read a scope back to make a decision. Both documents now source their lists from here, and Grants is the one place a scope is checked.

Index

Constants

View Source
const (
	// OpenID, Profile and Email are identity scopes. They say something about
	// the user; they grant no access to a resource.
	OpenID  = "openid"
	Profile = "profile"
	Email   = "email"

	// MCP grants access to the tool endpoints and their MCP transports. It is
	// the only resource scope: mcp_read/mcp_write were advertised but never
	// requested, granted or checked, and honouring them would mean gating
	// individual MCP methods.
	MCP = "mcp"
)

The scopes this platform understands.

View Source
const Default = MCP

Default is granted when a client requests no scope at all, so that a client which omits the parameter still ends up with a usable MCP token.

Variables

View Source
var Resource = []string{MCP}

Resource is what the gateway's /.well-known/oauth-protected-resource advertises: the scopes that actually gate access to a resource.

View Source
var Supported = []string{OpenID, Profile, Email, MCP}

Supported is what /.well-known/oauth-authorization-server advertises as scopes_supported, and what an authorization request is validated against.

Functions

func Grants

func Grants(tokenScope, required string) bool

Grants reports whether a token's scope string - space-separated, per RFC 6749 section 3.3 - includes the required scope.

func IsSupported

func IsSupported(scope string) bool

IsSupported reports whether a single scope value is one this platform issues.

func Unsupported

func Unsupported(requested string) []string

Unsupported returns the scopes in a requested scope string that this platform does not issue. An empty result means the request is acceptable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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