init
This commit is contained in:
commit
b15b95781c
108 changed files with 14802 additions and 0 deletions
16
internal/auth/context.go
Normal file
16
internal/auth/context.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package auth
|
||||
|
||||
import "context"
|
||||
|
||||
type contextKey string
|
||||
|
||||
const sessionStateKey contextKey = "auth.session-state"
|
||||
|
||||
func NewContext(ctx context.Context, state *SessionState) context.Context {
|
||||
return context.WithValue(ctx, sessionStateKey, state)
|
||||
}
|
||||
|
||||
func FromContext(ctx context.Context) (*SessionState, bool) {
|
||||
state, ok := ctx.Value(sessionStateKey).(*SessionState)
|
||||
return state, ok
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue