File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -277,10 +277,14 @@ func APIContexter() func(http.Handler) http.Handler {
277
277
next .ServeHTTP (ctx .Resp , ctx .Req )
278
278
279
279
// Handle adding signedUserName to the context for the AccessLogger
280
- username := ctx .Data ["SignedUserName" ].(string )
281
- identityPtr := ctx .Req .Context ().Value (signedUserNameStringPointerKey ).(* string )
282
- if identityPtr != nil && username != "" {
283
- * identityPtr = username
280
+ usernameInterface := ctx .Data ["SignedUserName" ]
281
+ identityPtrInterface := ctx .Req .Context ().Value (signedUserNameStringPointerKey )
282
+ if usernameInterface != nil && identityPtrInterface != nil {
283
+ username := usernameInterface .(string )
284
+ identityPtr := identityPtrInterface .(* string )
285
+ if identityPtr != nil && username != "" {
286
+ * identityPtr = username
287
+ }
284
288
}
285
289
})
286
290
}
Original file line number Diff line number Diff line change @@ -772,12 +772,15 @@ func Contexter() func(next http.Handler) http.Handler {
772
772
next .ServeHTTP (ctx .Resp , ctx .Req )
773
773
774
774
// Handle adding signedUserName to the context for the AccessLogger
775
- username := ctx .Data ["SignedUserName" ].(string )
776
- identityPtr := ctx .Req .Context ().Value (signedUserNameStringPointerKey ).(* string )
777
- if identityPtr != nil && username != "" {
778
- * identityPtr = username
775
+ usernameInterface := ctx .Data ["SignedUserName" ]
776
+ identityPtrInterface := ctx .Req .Context ().Value (signedUserNameStringPointerKey )
777
+ if usernameInterface != nil && identityPtrInterface != nil {
778
+ username := usernameInterface .(string )
779
+ identityPtr := identityPtrInterface .(* string )
780
+ if identityPtr != nil && username != "" {
781
+ * identityPtr = username
782
+ }
779
783
}
780
-
781
784
})
782
785
}
783
786
}
You can’t perform that action at this time.
0 commit comments