mirror of
https://github.com/paralus/paralus.git
synced 2026-05-11 02:46:57 +00:00
* restructure rcloud-base as a single base controller * updated master.rest * moved sentry from internal to pkg as it is used by relay * removing unused rpc and it's dependencies * Fix usermgmt tests * Don't redefine variables in rest file Co-authored-by: Abin Simon <abin.simon@rafay.co>
21 lines
454 B
Go
21 lines
454 B
Go
package authv3
|
|
|
|
import (
|
|
"context"
|
|
|
|
commonv3 "github.com/RafaySystems/rcloud-base/proto/types/commonpb/v3"
|
|
)
|
|
|
|
type contextKey struct{}
|
|
|
|
var sessionDataKey contextKey
|
|
|
|
func newSessionContext(ctx context.Context, s *commonv3.SessionData) context.Context {
|
|
return context.WithValue(ctx, sessionDataKey, s)
|
|
}
|
|
|
|
func GetSession(ctx context.Context) (*commonv3.SessionData, bool) {
|
|
s, ok := ctx.Value(sessionDataKey).(*commonv3.SessionData)
|
|
return s, ok
|
|
}
|