frontend/Mi: add tokenIntrospectURL

This commit is contained in:
Cadey Ratio 2020-11-04 17:21:50 -05:00
parent b06a90ccc5
commit 0d6f7fde0c
1 changed files with 13 additions and 3 deletions

View File

@ -1,12 +1,15 @@
module Mi exposing (TokenData, errorToString, expectJson, request, tokenDecoder)
module Mi exposing (TokenData, errorToString, expectJson, request, tokenDecoder, tokenIntrospectURL)
import Http exposing (Error(..))
import Json.Decode as D
import Url.Builder as UB
type alias TokenData =
{ sub : String
, jti : String, aud: String, iss: String
, jti : String
, aud : String
, iss : String
}
@ -19,6 +22,13 @@ tokenDecoder =
(D.field "iss" D.string)
tokenIntrospectURL : String
tokenIntrospectURL =
UB.absolute
[ "api", "token", "info" ]
[]
request method token path body expect =
Http.request
{ method = method
@ -75,4 +85,4 @@ errorToString err =
"Unexpected response from api: " ++ text
BadUrl url ->
"Malformed url: " ++ url
"Malformed url: " ++ url