• Steven's avatar
    refactor: consolidate duplicated auth logic into auth package · 26d10212
    Steven authored
    Add ApplyToContext and AuthenticateToUser helpers to the auth package,
    then remove the duplicated auth code spread across the MCP middleware,
    file server, Connect interceptor, and gRPC-Gateway middleware.
    
    - auth.ApplyToContext: single place to set claims/user into context after Authenticate()
    - auth.AuthenticateToUser: resolves any credential (bearer token or refresh cookie) to a *store.User
    - MCP middleware: replaced manual PAT DB lookup + expiry check with Authenticator.AuthenticateByPAT
    - File server: replaced authenticateByBearerToken/authenticateByRefreshToken with AuthenticateToUser
    - Connect interceptor + Gateway middleware: replaced duplicated context-setting block with ApplyToContext
    - MCPService now accepts secret to construct its own Authenticator
    26d10212
Name
Last commit
Last update
.github Loading commit data...
cmd/memos Loading commit data...
internal Loading commit data...
plugin Loading commit data...
proto Loading commit data...
scripts Loading commit data...
server Loading commit data...
store Loading commit data...
web Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
.golangci.yaml Loading commit data...
AGENTS.md Loading commit data...
CODEOWNERS Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
SECURITY.md Loading commit data...
go.mod Loading commit data...
go.sum Loading commit data...