Skip to content

Commit f2d02d9

Browse files
committed
Fixes
1 parent e1f82a9 commit f2d02d9

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

integration/main_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ func TestMain(m *testing.M) {
5353
os.Exit(exitCode)
5454
}()
5555

56-
// Start mock GCP server for OAuth
57-
mockGCP := NewMockGCPServer("9090")
58-
err := mockGCP.Start()
56+
// Start fake GCP server for OAuth
57+
fakeGCP := NewFakeGCPServer("9090")
58+
err := fakeGCP.Start()
5959
if err != nil {
60-
fmt.Printf("Failed to start mock GCP server: %v\n", err)
60+
fmt.Printf("Failed to start fake GCP server: %v\n", err)
6161
exitCode = 1
6262
return
6363
}
6464
defer func() {
65-
_ = mockGCP.Stop()
65+
_ = fakeGCP.Stop()
6666
}()
6767

6868
// Wait for database to be ready

integration/test_utils.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -467,14 +467,14 @@ func (c *MCPStreamableClient) close() {
467467
c.serverName = ""
468468
}
469469

470-
// MockGCPServer provides a mock GCP IAM server for testing
471-
type MockGCPServer struct {
470+
// FakeGCPServer provides a fake GCP OAuth server for testing
471+
type FakeGCPServer struct {
472472
server *http.Server
473473
port string
474474
}
475475

476-
// NewMockGCPServer creates a new mock GCP server
477-
func NewMockGCPServer(port string) *MockGCPServer {
476+
// NewFakeGCPServer creates a new fake GCP server
477+
func NewFakeGCPServer(port string) *FakeGCPServer {
478478
mux := http.NewServeMux()
479479

480480
mux.HandleFunc("/auth", func(w http.ResponseWriter, r *http.Request) {
@@ -523,14 +523,14 @@ func NewMockGCPServer(port string) *MockGCPServer {
523523
Handler: mux,
524524
}
525525

526-
return &MockGCPServer{
526+
return &FakeGCPServer{
527527
server: server,
528528
port: port,
529529
}
530530
}
531531

532-
// Start starts the mock GCP server
533-
func (m *MockGCPServer) Start() error {
532+
// Start starts the fake GCP server
533+
func (m *FakeGCPServer) Start() error {
534534
go func() {
535535
if err := m.server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
536536
panic(err)
@@ -541,8 +541,8 @@ func (m *MockGCPServer) Start() error {
541541
return nil
542542
}
543543

544-
// Stop stops the mock GCP server
545-
func (m *MockGCPServer) Stop() error {
544+
// Stop stops the fake GCP server
545+
func (m *FakeGCPServer) Stop() error {
546546
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
547547
defer cancel()
548548
return m.server.Shutdown(ctx)
@@ -552,7 +552,7 @@ func (m *MockGCPServer) Stop() error {
552552
type TestEnvironment struct {
553553
dbCmd *exec.Cmd
554554
mcpCmd *exec.Cmd
555-
mockGCP *MockGCPServer
555+
fakeGCP *FakeGCPServer
556556
client *MCPSSEClient
557557
}
558558

@@ -571,8 +571,8 @@ func SetupTestEnvironment(t *testing.T) *TestEnvironment {
571571

572572
// Start mock GCP server
573573
t.Log("🚀 Starting mock GCP server...")
574-
env.mockGCP = NewMockGCPServer("9090")
575-
if err := env.mockGCP.Start(); err != nil {
574+
env.fakeGCP = NewFakeGCPServer("9090")
575+
if err := env.fakeGCP.Start(); err != nil {
576576
t.Fatalf("Failed to start mock GCP server: %v", err)
577577
}
578578

@@ -611,8 +611,8 @@ func (env *TestEnvironment) Cleanup() {
611611
_ = env.mcpCmd.Process.Kill()
612612
}
613613

614-
if env.mockGCP != nil {
615-
_ = env.mockGCP.Stop()
614+
if env.fakeGCP != nil {
615+
_ = env.fakeGCP.Stop()
616616
}
617617

618618
if env.dbCmd != nil {

internal/server/auth_handlers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12+
"github.com/dgellow/mcp-front/internal"
1213
"github.com/dgellow/mcp-front/internal/auth"
1314
"github.com/dgellow/mcp-front/internal/config"
1415
"github.com/dgellow/mcp-front/internal/crypto"
@@ -215,7 +216,7 @@ func (h *AuthHandlers) GoogleCallbackHandler(w http.ResponseWriter, r *http.Requ
215216
Value: encryptedData,
216217
Path: "/",
217218
HttpOnly: true,
218-
Secure: true,
219+
Secure: !internal.IsDevelopmentMode(),
219220
SameSite: http.SameSiteStrictMode,
220221
MaxAge: int(h.authServer.GetConfig().SessionDuration.Seconds()),
221222
})

internal/server/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func NewServer(ctx context.Context, cfg *config.Config) (*Server, error) {
127127
authConfig := auth.Config{
128128
Issuer: oauthAuth.Issuer,
129129
TokenTTL: ttl,
130+
SessionDuration: 24 * time.Hour, // Default session duration for browser SSO
130131
AllowedDomains: oauthAuth.AllowedDomains,
131132
AllowedOrigins: oauthAuth.AllowedOrigins,
132133
GoogleClientID: oauthAuth.GoogleClientID,

0 commit comments

Comments
 (0)