Merge pull request #10559 from owncloud/idp_remove_context_session

fix: remove context from the session
This commit is contained in:
Juan Pablo Villafañez
2024-11-15 09:44:45 +01:00
committed by GitHub
2 changed files with 6 additions and 17 deletions

View File

@@ -95,7 +95,7 @@ func (b *CS3Backend) Logon(ctx context.Context, audience, username, password str
return false, nil, nil, nil, fmt.Errorf("cs3 backend basic authenticate failed with code %s: %s", res.GetStatus().GetCode().String(), res.GetStatus().GetMessage())
}
session := createSession(ctx, res.GetUser())
session := createSession(res.GetUser())
user, err := newCS3User(res.GetUser())
if err != nil {
@@ -155,7 +155,7 @@ func (b *CS3Backend) GetUser(ctx context.Context, userEntryID string, sessionRef
}
// cache session
session = createSession(ctx, res.GetUser())
session = createSession(res.GetUser())
b.sessions.Set(*sessionRef, session)
user, err := newCS3User(res.GetUser())

View File

@@ -1,7 +1,6 @@
package cs3
import (
"context"
"time"
cs3user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
@@ -9,17 +8,9 @@ import (
// createSession creates a new Session without the server using the provided
// data.
func createSession(ctx context.Context, u *cs3user.User) *cs3Session {
if ctx == nil {
ctx = context.Background()
}
sessionCtx, cancel := context.WithCancel(ctx)
func createSession(u *cs3user.User) *cs3Session {
s := &cs3Session{
ctx: sessionCtx,
u: u,
ctxCancel: cancel,
u: u,
}
s.when = time.Now()
@@ -28,10 +19,8 @@ func createSession(ctx context.Context, u *cs3user.User) *cs3Session {
}
type cs3Session struct {
ctx context.Context
ctxCancel context.CancelFunc
u *cs3user.User
when time.Time
u *cs3user.User
when time.Time
}
// User returns the cs3 user of the session