(r *http.Request)
| 73 | } |
| 74 | |
| 75 | func canSkipCSRFCheck(r *http.Request) bool { |
| 76 | authVal := r.Header.Get("Authorization") |
| 77 | if !strings.HasPrefix(authVal, "Bearer ") { |
| 78 | return true // Unauthenticated requests don't need CSRF protection. |
| 79 | } |
| 80 | _, _, _, err := auth.SplitToken(strings.TrimPrefix(authVal, "Bearer ")) |
| 81 | if err != nil { |
| 82 | return true // Unsupported Bearer tokens don't need CSRF protection. |
| 83 | } |
| 84 | return false |
| 85 | } |
no test coverage detected