Skip to content

Commit

Permalink
Merge branch '4.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Nov 6, 2018
2 parents e3c1362 + 053eede commit b0b5268
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v4.0.1 (2018-10-06)

- (15e4e82) Bug Fix: make token\_type parsing case-insensitive.


## v4.0.0 (2018-09-07)


Expand Down
1 change: 1 addition & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

function untag () {
git tag -d $1
git push origin --delete $1
}

Expand Down
2 changes: 1 addition & 1 deletion elm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "package",
"name": "truqu/elm-oauth2",
"version": "4.0.0",
"version": "4.0.1",
"license": "MIT",
"summary": "OAuth 2.0 client-side utils",
"exposed-modules": [
Expand Down
28 changes: 17 additions & 11 deletions src/OAuth.elm
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,8 @@ or Query parsers. Returns 'Nothing' when the token type is Nothing
, different from Just "Bearer" or when there's no token at all.
-}
makeToken : Maybe TokenType -> Maybe TokenString -> Maybe Token
makeToken mTokenType mToken =
let
construct a b =
tokenFromString (a ++ " " ++ b)
in
maybeAndThen2 construct mTokenType mToken
makeToken =
maybeAndThen2 tryMakeToken


{-| See 'makeToken', with the subtle difference that a token value may or
Expand All @@ -108,11 +104,7 @@ present or not.
-}
makeRefreshToken : TokenType -> Maybe TokenString -> Maybe (Maybe Token)
makeRefreshToken tokenType mToken =
let
construct a b =
tokenFromString (a ++ " " ++ b)
in
case ( mToken, maybeAndThen2 construct (Just tokenType) mToken ) of
case ( mToken, maybeAndThen2 tryMakeToken (Just tokenType) mToken ) of
( Nothing, _ ) ->
Just Nothing

Expand All @@ -123,6 +115,20 @@ makeRefreshToken tokenType mToken =
Nothing



{- | Internal, attempt to make a Bearer token from a type and a token string -}


tryMakeToken : TokenType -> TokenString -> Maybe Token
tryMakeToken tokenType token =
case String.toLower tokenType of
"bearer" ->
Just (Bearer token)

_ ->
Nothing


{-| Gets the `String` representation of a `Token` to be used in an 'Authorization' header
-}
tokenToString : Token -> String
Expand Down

0 comments on commit b0b5268

Please sign in to comment.