From ebbd8b792c22ed6ccd94dcfb39f5323861f10849 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 20 Nov 2016 11:57:15 +0300 Subject: oauth2 callback state: include query params If method of the original query is GET, redirect to original path with query parameters. Otherwise redirect to "/". Previously, when unauthenticated users click on "https://example.net/foo?bar", they are redirected to "https://example.net/foo" after authentication. Now, they will be redirected to "https://example.net/foo?bar" --- src/Sproxy/Application.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Sproxy/Application.hs b/src/Sproxy/Application.hs index 2391220..e4cc3ab 100644 --- a/src/Sproxy/Application.hs +++ b/src/Sproxy/Application.hs @@ -243,7 +243,9 @@ authenticationRequired key oa2 req resp = do Log.info $ "511 Unauthenticated: " ++ showReq req resp $ W.responseLBS networkAuthenticationRequired511 [(hContentType, "text/html; charset=utf-8")] page where - path = W.rawPathInfo req -- FIXME: make it more robust for non-GET or XMLHTTPRequest? + path = if W.requestMethod req == methodGet + then W.rawPathInfo req <> W.rawQueryString req + else "/" state = State.encode key path authLink :: Text -> OAuth2Client -> ByteString -> ByteString authLink provider oa2c html = -- cgit v1.2.3