(t *testing.T, apiClient *hydra.APIClient, subject string, cb func(*testing.T, *hydra.OAuth2LoginRequest, error) hydra.AcceptOAuth2LoginRequest)
| 169 | } |
| 170 | |
| 171 | func checkAndDuplicateAcceptLoginHandler(t *testing.T, apiClient *hydra.APIClient, subject string, cb func(*testing.T, *hydra.OAuth2LoginRequest, error) hydra.AcceptOAuth2LoginRequest) http.HandlerFunc { |
| 172 | return func(w http.ResponseWriter, r *http.Request) { |
| 173 | res, _, err := apiClient.OAuth2API.GetOAuth2LoginRequest(context.Background()).LoginChallenge(r.URL.Query().Get("login_challenge")).Execute() |
| 174 | payload := cb(t, res, err) |
| 175 | payload.Subject = subject |
| 176 | |
| 177 | v, _, err := apiClient.OAuth2API.AcceptOAuth2LoginRequest(context.Background()). |
| 178 | LoginChallenge(r.URL.Query().Get("login_challenge")). |
| 179 | AcceptOAuth2LoginRequest(payload). |
| 180 | Execute() |
| 181 | require.NoError(t, err) |
| 182 | require.NotEmpty(t, v.RedirectTo) |
| 183 | |
| 184 | v2, _, err := apiClient.OAuth2API.AcceptOAuth2LoginRequest(context.Background()). |
| 185 | LoginChallenge(r.URL.Query().Get("login_challenge")). |
| 186 | AcceptOAuth2LoginRequest(payload). |
| 187 | Execute() |
| 188 | require.NoError(t, err) |
| 189 | require.NotEmpty(t, v2.RedirectTo) |
| 190 | http.Redirect(w, r, v2.RedirectTo, http.StatusFound) |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | func checkAndDuplicateAcceptConsentHandler(t *testing.T, apiClient *hydra.APIClient, cb func(*testing.T, *hydra.OAuth2ConsentRequest, error) hydra.AcceptOAuth2ConsentRequest) http.HandlerFunc { |
| 195 | return func(w http.ResponseWriter, r *http.Request) { |
no test coverage detected