You've already forked agentic-coding-workflow
feat(mcp): admin token CRUD HTTP handler (POST/GET/DELETE) + TokenService.List/GetByID
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,8 @@ type TokenService interface {
|
||||
Authenticate(ctx context.Context, plaintext string) (*Token, error)
|
||||
Revoke(ctx context.Context, id, byUserID uuid.UUID) error
|
||||
RevokeBySession(ctx context.Context, sessionID uuid.UUID) error
|
||||
List(ctx context.Context, callerUserID *uuid.UUID, activeOnly bool) ([]*Token, error)
|
||||
GetByID(ctx context.Context, id uuid.UUID) (*Token, error)
|
||||
}
|
||||
|
||||
// IssueAdminInput 是 admin 签发时的入参。UserID 缺省 = 当前 admin 自己(由调用方填)。
|
||||
@@ -278,3 +280,11 @@ func (s *tokenService) RevokeBySession(ctx context.Context, sessionID uuid.UUID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tokenService) List(ctx context.Context, callerUserID *uuid.UUID, activeOnly bool) ([]*Token, error) {
|
||||
return s.repo.List(ctx, callerUserID, activeOnly)
|
||||
}
|
||||
|
||||
func (s *tokenService) GetByID(ctx context.Context, id uuid.UUID) (*Token, error) {
|
||||
return s.repo.GetByID(ctx, id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user