TestHTTP_Authorize_WithSession redirects to {publicURL}/oauth/consent preserving every authorize parameter so the consent page can hidden- field them back into its POST.
(t *testing.T)
| 242 | // preserving every authorize parameter so the consent page can hidden- |
| 243 | // field them back into its POST. |
| 244 | func TestHTTP_Authorize_WithSession(t *testing.T) { |
| 245 | f := newConsentFixture(t) |
| 246 | _, challenge := newPKCE(t) |
| 247 | q := authorizeParams(challenge, f.clientID, "s1s1s1s1s1s1s1s1") |
| 248 | resp := f.authorizeRequest(t, q, true) |
| 249 | defer resp.Body.Close() |
| 250 | if resp.StatusCode != http.StatusFound { |
| 251 | t.Fatalf("status = %d, want 302", resp.StatusCode) |
| 252 | } |
| 253 | loc, err := url.Parse(resp.Header.Get("Location")) |
| 254 | if err != nil { |
| 255 | t.Fatalf("Location parse: %v", err) |
| 256 | } |
| 257 | if !strings.HasSuffix(loc.Path, "/oauth/consent") { |
| 258 | t.Errorf("Location path = %q, want /oauth/consent", loc.Path) |
| 259 | } |
| 260 | for _, key := range []string{"response_type", "client_id", "redirect_uri", "scope", "state", "code_challenge", "code_challenge_method"} { |
| 261 | if got, want := loc.Query().Get(key), q.Get(key); got != want { |
| 262 | t.Errorf("consent redirect missing/wrong %q: got %q, want %q", key, got, want) |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | // TestHTTP_Authorize_InvalidClient — fosite rejects before we get a |
| 268 | // chance to check the session. The response is a fosite-emitted |
nothing calls this directly
no test coverage detected