@@ -6,10 +6,7 @@ import (
66 "github.com/github/github-mcp-server/pkg/utils"
77)
88
9- // tokenCtxKey is a context key for authentication token information
10- type tokenCtx string
11-
12- var tokenCtxKey tokenCtx = "tokenctx"
9+ type tokenCtxKey struct {}
1310
1411type TokenInfo struct {
1512 Token string
@@ -18,29 +15,27 @@ type TokenInfo struct {
1815
1916// WithTokenInfo adds TokenInfo to the context
2017func WithTokenInfo (ctx context.Context , tokenInfo * TokenInfo ) context.Context {
21- return context .WithValue (ctx , tokenCtxKey , tokenInfo )
18+ return context .WithValue (ctx , tokenCtxKey {} , tokenInfo )
2219}
2320
2421// GetTokenInfo retrieves the authentication token from the context
2522func GetTokenInfo (ctx context.Context ) (* TokenInfo , bool ) {
26- if tokenInfo , ok := ctx .Value (tokenCtxKey ).(* TokenInfo ); ok {
23+ if tokenInfo , ok := ctx .Value (tokenCtxKey {} ).(* TokenInfo ); ok {
2724 return tokenInfo , true
2825 }
2926 return nil , false
3027}
3128
32- type TokenScopesKey tokenCtx
33-
34- var tokenScopesKey TokenScopesKey = "tokenscopesctx"
29+ type tokenScopesKey struct {}
3530
3631// WithTokenScopes adds token scopes to the context
3732func WithTokenScopes (ctx context.Context , scopes []string ) context.Context {
38- return context .WithValue (ctx , tokenScopesKey , scopes )
33+ return context .WithValue (ctx , tokenScopesKey {} , scopes )
3934}
4035
4136// GetTokenScopes retrieves token scopes from the context
4237func GetTokenScopes (ctx context.Context ) ([]string , bool ) {
43- if scopes , ok := ctx .Value (tokenScopesKey ).([]string ); ok {
38+ if scopes , ok := ctx .Value (tokenScopesKey {} ).([]string ); ok {
4439 return scopes , true
4540 }
4641 return nil , false
0 commit comments