diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-08T12·44+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-08T12·44+0100 |
commit | d34b146702476f46bcca7d362e56f46227863f1b (patch) | |
tree | 6ad489c4509172780f578df9d66602a1c6a6272f /website/sandbox/learnpianochords/src/server/TestUtils.hs | |
parent | 926d8e643e9ffb7d5f5608793d35381742675073 (diff) |
Tests valid and invalid JWTs for the "aud" field
Test that when the JWT contains the client ID for my Google app, the JWT is valid, and when it doesn't, it's invalid.
Diffstat (limited to 'website/sandbox/learnpianochords/src/server/TestUtils.hs')
-rw-r--r-- | website/sandbox/learnpianochords/src/server/TestUtils.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/website/sandbox/learnpianochords/src/server/TestUtils.hs b/website/sandbox/learnpianochords/src/server/TestUtils.hs new file mode 100644 index 000000000000..c586f7f219ba --- /dev/null +++ b/website/sandbox/learnpianochords/src/server/TestUtils.hs @@ -0,0 +1,12 @@ +-------------------------------------------------------------------------------- +module TestUtils where +-------------------------------------------------------------------------------- +import Web.JWT +import Data.String.Conversions (cs) +-------------------------------------------------------------------------------- + +unsafeStringOrURI :: String -> StringOrURI +unsafeStringOrURI x = + case stringOrURI (cs x) of + Nothing -> error $ "Failed to convert to StringOrURI: " ++ x + Just x -> x |