frontend/Mi: add tokenIntrospectURL
This commit is contained in:
parent
b06a90ccc5
commit
0d6f7fde0c
|
@ -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 Http exposing (Error(..))
|
||||||
import Json.Decode as D
|
import Json.Decode as D
|
||||||
|
import Url.Builder as UB
|
||||||
|
|
||||||
|
|
||||||
type alias TokenData =
|
type alias TokenData =
|
||||||
{ sub : String
|
{ sub : String
|
||||||
, jti : String, aud: String, iss: String
|
, jti : String
|
||||||
|
, aud : String
|
||||||
|
, iss : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +22,13 @@ tokenDecoder =
|
||||||
(D.field "iss" D.string)
|
(D.field "iss" D.string)
|
||||||
|
|
||||||
|
|
||||||
|
tokenIntrospectURL : String
|
||||||
|
tokenIntrospectURL =
|
||||||
|
UB.absolute
|
||||||
|
[ "api", "token", "info" ]
|
||||||
|
[]
|
||||||
|
|
||||||
|
|
||||||
request method token path body expect =
|
request method token path body expect =
|
||||||
Http.request
|
Http.request
|
||||||
{ method = method
|
{ method = method
|
||||||
|
@ -75,4 +85,4 @@ errorToString err =
|
||||||
"Unexpected response from api: " ++ text
|
"Unexpected response from api: " ++ text
|
||||||
|
|
||||||
BadUrl url ->
|
BadUrl url ->
|
||||||
"Malformed url: " ++ url
|
"Malformed url: " ++ url
|
||||||
|
|
Loading…
Reference in New Issue