Files
opencloud/services/idp/pkg/backends/cs3/identifier/session.go
T
Christian Richter 78064e6bab rename folder extensions -> services
Signed-off-by: Christian Richter <crichter@owncloud.com>
2022-06-27 14:05:36 +02:00

41 lines
719 B
Go

package cs3
import (
"context"
"time"
cs3user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
)
// 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)
s := &cs3Session{
ctx: sessionCtx,
u: u,
ctxCancel: cancel,
}
s.when = time.Now()
return s
}
type cs3Session struct {
ctx context.Context
ctxCancel context.CancelFunc
u *cs3user.User
when time.Time
}
// User returns the cs3 user of the session
func (s *cs3Session) User() *cs3user.User {
return s.u
}