replace '=' in query params
This commit is contained in:
parent
100e4f8765
commit
123cf76b3b
@ -42,7 +42,7 @@ genUnencryptedCode client url expiration state = do
|
|||||||
now <- getCurrentTime
|
now <- getCurrentTime
|
||||||
let
|
let
|
||||||
expiresAt = expiration `addUTCTime` now
|
expiresAt = expiration `addUTCTime` now
|
||||||
simpleCode = replace "=" "" . encodeBase64 . pack . filter (/= ' ') $ client <> url <> show now <> show expiresAt
|
simpleCode = replace "=" "%3D" . encodeBase64 . pack . filter (/= ' ') $ client <> url <> show now <> show expiresAt
|
||||||
success <- atomically . stateTVar state $ \s ->
|
success <- atomically . stateTVar state $ \s ->
|
||||||
let mEntry = M.lookup simpleCode s.activeCodes
|
let mEntry = M.lookup simpleCode s.activeCodes
|
||||||
in
|
in
|
||||||
|
|||||||
@ -85,7 +85,7 @@ type QScope = String
|
|||||||
type QClient = String
|
type QClient = String
|
||||||
type QResType = String
|
type QResType = String
|
||||||
type QRedirect = String
|
type QRedirect = String
|
||||||
type QState = String
|
type QState = Text
|
||||||
|
|
||||||
type QParam = QueryParam' [Required, Strict]
|
type QParam = QueryParam' [Required, Strict]
|
||||||
|
|
||||||
@ -130,12 +130,12 @@ authServer = handleAuth
|
|||||||
redirect :: Maybe ByteString -> AuthHandler userData
|
redirect :: Maybe ByteString -> AuthHandler userData
|
||||||
redirect (Just url) = liftIO (print url) >> throwError err303 { errHeaders = [("Location", url)]}
|
redirect (Just url) = liftIO (print url) >> throwError err303 { errHeaders = [("Location", url)]}
|
||||||
redirect Nothing = throwError err500 { errBody = "Could not generate authorisation code."}
|
redirect Nothing = throwError err500 { errBody = "Could not generate authorisation code."}
|
||||||
addParams :: String -> Maybe Text -> Maybe String -> Maybe ByteString
|
addParams :: String -> Maybe Text -> Maybe Text -> Maybe ByteString
|
||||||
addParams url Nothing _ = Nothing
|
addParams url Nothing _ = Nothing
|
||||||
addParams url (Just code) mState =
|
addParams url (Just code) mState =
|
||||||
let qPos = fromMaybe (length url) $ elemIndex '?' url
|
let qPos = fromMaybe (length url) $ elemIndex '?' url
|
||||||
(pre, post) = splitAt qPos url
|
(pre, post) = splitAt qPos url
|
||||||
rState = case mState of {Just s -> "&state=" ++ s; Nothing -> ""}
|
rState = case mState of {Just s -> "&state=" ++ (unpack $ replace "=" "%3D" s); Nothing -> ""}
|
||||||
post' = if not (null post) then '&' : tail post else post
|
post' = if not (null post) then '&' : tail post else post
|
||||||
in Just . fromString $ pre ++ "?code=" ++ (unpack code) ++ post' ++ rState
|
in Just . fromString $ pre ++ "?code=" ++ (unpack code) ++ post' ++ rState
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user