Merge pull request #10559 from owncloud/idp_remove_context_session
fix: remove context from the session
This commit is contained in:
@@ -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())
|
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())
|
user, err := newCS3User(res.GetUser())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -155,7 +155,7 @@ func (b *CS3Backend) GetUser(ctx context.Context, userEntryID string, sessionRef
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cache session
|
// cache session
|
||||||
session = createSession(ctx, res.GetUser())
|
session = createSession(res.GetUser())
|
||||||
b.sessions.Set(*sessionRef, session)
|
b.sessions.Set(*sessionRef, session)
|
||||||
|
|
||||||
user, err := newCS3User(res.GetUser())
|
user, err := newCS3User(res.GetUser())
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package cs3
|
package cs3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cs3user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
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
|
// createSession creates a new Session without the server using the provided
|
||||||
// data.
|
// data.
|
||||||
func createSession(ctx context.Context, u *cs3user.User) *cs3Session {
|
func createSession(u *cs3user.User) *cs3Session {
|
||||||
|
|
||||||
if ctx == nil {
|
|
||||||
ctx = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
sessionCtx, cancel := context.WithCancel(ctx)
|
|
||||||
s := &cs3Session{
|
s := &cs3Session{
|
||||||
ctx: sessionCtx,
|
u: u,
|
||||||
u: u,
|
|
||||||
ctxCancel: cancel,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s.when = time.Now()
|
s.when = time.Now()
|
||||||
@@ -28,10 +19,8 @@ func createSession(ctx context.Context, u *cs3user.User) *cs3Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type cs3Session struct {
|
type cs3Session struct {
|
||||||
ctx context.Context
|
u *cs3user.User
|
||||||
ctxCancel context.CancelFunc
|
when time.Time
|
||||||
u *cs3user.User
|
|
||||||
when time.Time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// User returns the cs3 user of the session
|
// User returns the cs3 user of the session
|
||||||
|
|||||||
Reference in New Issue
Block a user