Commit Graph

47 Commits (d688914b2864791eeadbf21c882608632875f17c)

Author SHA1 Message Date
boojack d688914b28
feat(auth): add SSO user identity linkage (#5883) 2 months ago
boojack 10a955fd62 refactor: move plugin packages under internal 2 months ago
memoclaw a24d420922
fix(api): restrict user email exposure to self and admins (#5784)
Co-authored-by: memoclaw <265580040+memoclaw@users.noreply.github.com>
3 months ago
memoclaw 92d937b1aa
feat: replace auto-increment ID with UID for identity provider resource names (#5687)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
3 months ago
Johnny c2aea5a4b7 feat: implement refresh token rotation with sliding window sessions in the auth service 6 months ago
Steven d0c3908168 refactor: remove deprecated Sessions and AccessTokens settings
- Remove ListSessions and RevokeSession RPC endpoints
- Remove Session message and SessionsSetting from UserSetting
- Remove ACCESS_TOKENS key and AccessTokensSetting
- Update references to use RefreshTokensUserSetting with its own ClientInfo
- Remove UserSessionsSection frontend component
- Clean up user store to remove session and access token settings
- Regenerate protobuf files

The system now uses:
- REFRESH_TOKENS for session management with sliding expiration
- PERSONAL_ACCESS_TOKENS for long-lived API tokens
6 months ago
Johnny 50606a850e fix(auth): resolve token refresh and persistence issues
- Fix cookie expiration timezone to use GMT (RFC 6265 compliance)
- Use Connect RPC client for token refresh instead of fetch
- Fix error code checking (numeric Code.Unauthenticated instead of string)
- Prevent infinite redirect loop when already on /auth page
- Fix protobuf Timestamp conversion using timestampDate helper
- Store access token in sessionStorage to avoid unnecessary refreshes on page reload
- Add refresh token cookie fallback for attachment authentication
- Improve error handling with proper type checking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
6 months ago
Johnny 7932f6d0d0
refactor: user auth improvements (#5360) 6 months ago
Johnny 40e129b8af refactor(auth): streamline session authentication and cookie handling 6 months ago
Steven 3d893a7394 fix(backend): implement protocol-agnostic header setting for dual gRPC/Connect-RPC support
Problem:
The codebase supports both native gRPC and Connect-RPC protocols, but auth
service was using grpc.SetHeader() which only works for native gRPC. This
caused "failed to set grpc header" errors when using Connect-RPC clients
(browsers using nice-grpc-web).

Solution:
- Created HeaderCarrier pattern for protocol-agnostic header setting
- HeaderCarrier stores headers in context for Connect-RPC requests
- Falls back to grpc.SetHeader for native gRPC requests
- Updated auth service to use SetResponseHeader() instead of grpc.SetHeader()
- Refactored Connect wrappers to use withHeaderCarrier() helper to eliminate
  code duplication

Additional fixes:
- Allow public methods when gRPC metadata is missing in ACL interceptor
- Properly handle ParseSessionCookieValue errors instead of ignoring them
- Fix buildSessionCookie to gracefully handle missing metadata

Files changed:
- server/router/api/v1/header_carrier.go: New protocol-agnostic header carrier
- server/router/api/v1/auth_service.go: Use SetResponseHeader, handle missing metadata
- server/router/api/v1/connect_services.go: Use withHeaderCarrier helper
- server/router/api/v1/acl.go: Allow public methods without metadata
- server/router/api/v1/connect_interceptors.go: Handle ParseSessionCookieValue errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
6 months ago
Johnny edd3ced9bf
refactor: migrate to connect-rpc (#5338) 6 months ago
Johnny 1a9bd32cf1 feat(auth): add PKCE support and enhance OAuth security
Implements critical OAuth 2.0 security improvements to protect against authorization code interception attacks and improve provider compatibility:

- Add PKCE (RFC 7636) support with SHA-256 code challenge/verifier
- Fix access token extraction to use standard field instead of Extra()
- Add OAuth error parameter handling (access_denied, invalid_scope, etc.)
- Maintain backward compatibility for non-PKCE flows

This brings the OAuth implementation up to modern security standards as recommended by Auth0, Okta, and the OAuth 2.0 Security Best Current Practice (RFC 8252).

Backend changes:
- Add code_verifier parameter to ExchangeToken with PKCE support
- Use token.AccessToken for better provider compatibility
- Update proto definition with optional code_verifier field

Frontend changes:
- Generate cryptographically secure PKCE parameters
- Include code_challenge in authorization requests
- Handle and display OAuth provider errors gracefully
- Pass code_verifier during token exchange

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
7 months ago
boojack 906412013f
refactor(api): remove test_auth.go and inline test helpers (#5235)
Co-authored-by: Claude <noreply@anthropic.com>
7 months ago
Steven 4c1d1c70d1 refactor: rename workspace to instance throughout codebase
Remove work-related terminology by renaming "workspace" to "instance"
across the entire application. This change better reflects that Memos
is a self-hosted tool suitable for personal and non-work use cases.

Breaking Changes:
- API endpoints: /api/v1/workspace/* → /api/v1/instance/*
- gRPC service: WorkspaceService → InstanceService
- Proto types: WorkspaceSetting → InstanceSetting
- Frontend translation keys: workspace-section → instance-section

Backend Changes:
- Renamed proto definitions and regenerated code
- Updated all store layer methods and database drivers
- Renamed service implementations and API handlers
- Updated cache from workspaceSettingCache to instanceSettingCache

Frontend Changes:
- Renamed service client: workspaceServiceClient → instanceServiceClient
- Updated all React components and state management
- Refactored stores: workspace.ts → instance.ts
- Updated all 32 locale translation files

All tests pass and both backend and frontend build successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
7 months ago
Steven f635d85bcf chore: fix reactions seed data
- Add comprehensive inline documentation for auth services
- Document session-based and token-based authentication flows
- Clarify authentication priority and validation logic
- Add detailed comments for JWT token structure and claims
- Fix reactions seed data to use memo UIDs instead of numeric IDs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
8 months ago
Johnny bc7decf642 refactor: remove unused constants 8 months ago
Steven c18d6927ba chore: update user session table 12 months ago
johnnyjoy 1fffc41f79 feat: sliding expiration for user sessions 12 months ago
Steven 42d1650c6d chore: tweak auth service 12 months ago
Steven 5821bb7a65 chore: update auth service 12 months ago
Steven 59eae4465a chore: update user session section 12 months ago
Johnny b8a37c7229 chore: fix linter 12 months ago
Johnny 4e3a4e36f6 feat: implement user sessions 12 months ago
Johnny 6e4d1d9100 fix: auth context 12 months ago
Johnny a2bfa82a88 fix: linter 12 months ago
Johnny 77b7fc4441 feat: implement user session 12 months ago
Johnny 741fe35c2a refactor: rename session methods in auth service 1 year ago
Steven d71fd2f84a refactor: auth service 1 year ago
Steven c9ab03e1a0 refactor: user service 1 year ago
Steven f1b365f928 refactor: clean packages 1 year ago
johnnyjoy ca79990679 refactor: merge sign in requests 1 year ago
johnnyjoy 966a108d52 chore: check signin with sso 1 year ago
johnnyjoy eb33a604b2 feat: support mapping avatar url from oauth2 1 year ago
johnnyjoy 702c092289 chore: update auth message 1 year ago
johnnyjoy 7a4d54bb3c chore: update error messages 2 years ago
Haohan Yang 044d46c36d
chore: replace `unmatchedEmailAndPasswordError` with unmatchedUsernameAndPasswordError` (#3889)
replace unmatchedEmailAndPasswordError with unmatchedUsernameAndPasswordError
2 years ago
Steven bb86482b71 chore: tweak setting name 2 years ago
Steven f0abd792c7 chore: update auth service 2 years ago
Steven 1167df29d8 feat: add security related settings 2 years ago
Steven 8bf7cdfd31 feat: add password auth flag 2 years ago
Steven c5900b355e chore: tweak signup checks 2 years ago
Steven 6825c1def4 fix: delete access token when sign out 2 years ago
Johnny ca463891f2
chore: fix linter warning for slog (#3604) 2 years ago
Johnny 736637a362
feat: add public flag instead of system setting to enable signup (#3589) 2 years ago
Steven 1ccfa81cf3 chore: tweak common function 2 years ago
Steven fb15386db2 chore: remove access token after sign out 2 years ago
Steven 20dd3e17f7 chore: rename router package 2 years ago