mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-03-03 03:44:35 +01:00
Fixup token-related comments
This commit is contained in:
parent
cd3d377e83
commit
cebba91cb0
@ -117,14 +117,14 @@ withCallbackAndState name oauth2 csrf = do
|
|||||||
getParentUrlRender :: MonadHandler m => m (Route (SubHandlerSite m) -> Text)
|
getParentUrlRender :: MonadHandler m => m (Route (SubHandlerSite m) -> Text)
|
||||||
getParentUrlRender = (.) <$> getUrlRender <*> getRouteToParent
|
getParentUrlRender = (.) <$> getUrlRender <*> getRouteToParent
|
||||||
|
|
||||||
-- | Set a random, ~30-character value in the session
|
-- | Set a random, ~64-byte value in the session
|
||||||
--
|
--
|
||||||
-- Some (but not all) providers decode a @+@ in the state token as a space when
|
-- Some (but not all) providers decode a @+@ in the state token as a space when
|
||||||
-- sending it back to us. We don't expect this and fail. And if we did code for
|
-- sending it back to us. We don't expect this and fail. And if we did code for
|
||||||
-- it, we'd then fail on the providers that /don't/ do that.
|
-- it, we'd then fail on the providers that /don't/ do that.
|
||||||
--
|
--
|
||||||
-- Therefore, we just exclude @+@ in our tokens, which means this function may
|
-- Therefore, we just exclude @+@ in our tokens, which means this function may
|
||||||
-- return slightly less than 30 characters.
|
-- return slightly fewer than 64 bytes.
|
||||||
setSessionCSRF :: MonadHandler m => Text -> m Text
|
setSessionCSRF :: MonadHandler m => Text -> m Text
|
||||||
setSessionCSRF sessionKey = do
|
setSessionCSRF sessionKey = do
|
||||||
csrfToken <- liftIO randomToken
|
csrfToken <- liftIO randomToken
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import Data.Text.Encoding (decodeUtf8)
|
|||||||
randomText
|
randomText
|
||||||
:: MonadRandom m
|
:: MonadRandom m
|
||||||
=> Int
|
=> Int
|
||||||
-- ^ Size in Bytes (note necessarily characters)
|
-- ^ Size in Bytes (not necessarily characters)
|
||||||
-> m Text
|
-> m Text
|
||||||
randomText size =
|
randomText size =
|
||||||
decodeUtf8 . convertToBase @ByteString Base64 <$> getRandomBytes size
|
decodeUtf8 . convertToBase @ByteString Base64 <$> getRandomBytes size
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user