writeOAuth2RegistrationError writes RFC 7591 compliant error responses
(_ context.Context, rw http.ResponseWriter, status int, errorCode, description string)
| 514 | |
| 515 | // writeOAuth2RegistrationError writes RFC 7591 compliant error responses |
| 516 | func writeOAuth2RegistrationError(_ context.Context, rw http.ResponseWriter, status int, errorCode, description string) { |
| 517 | // RFC 7591 error response format |
| 518 | errorResponse := map[string]string{ |
| 519 | "error": errorCode, |
| 520 | } |
| 521 | if description != "" { |
| 522 | errorResponse["error_description"] = description |
| 523 | } |
| 524 | |
| 525 | rw.Header().Set("Content-Type", "application/json") |
| 526 | rw.WriteHeader(status) |
| 527 | _ = json.NewEncoder(rw).Encode(errorResponse) |
| 528 | } |
| 529 | |
| 530 | // createDisplaySecret creates a display version of the secret showing only the last few characters |
| 531 | func createDisplaySecret(secret string) string { |
no test coverage detected