fix: refactor schema for open id claim standards
This commit is contained in:
23
server/utils/gin_context.go
Normal file
23
server/utils/gin_context.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GinContextFromContext(ctx context.Context) (*gin.Context, error) {
|
||||
ginContext := ctx.Value("GinContextKey")
|
||||
if ginContext == nil {
|
||||
err := fmt.Errorf("could not retrieve gin.Context")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gc, ok := ginContext.(*gin.Context)
|
||||
if !ok {
|
||||
err := fmt.Errorf("gin.Context has wrong type")
|
||||
return nil, err
|
||||
}
|
||||
return gc, nil
|
||||
}
|
Reference in New Issue
Block a user