feat: add first page with auth and containers list and agents
This commit is contained in:
16
server/internal/api/context.go
Normal file
16
server/internal/api/context.go
Normal file
@ -0,0 +1,16 @@
|
||||
package api
|
||||
|
||||
import "context"
|
||||
|
||||
type contextKey int
|
||||
|
||||
const claimsKey contextKey = iota
|
||||
|
||||
func contextWithClaims(ctx context.Context, c *jwtClaims) context.Context {
|
||||
return context.WithValue(ctx, claimsKey, c)
|
||||
}
|
||||
|
||||
func claimsFromContext(r interface{ Context() context.Context }) (*jwtClaims, bool) {
|
||||
c, ok := r.Context().Value(claimsKey).(*jwtClaims)
|
||||
return c, ok && c != nil
|
||||
}
|
||||
Reference in New Issue
Block a user