Skip to content

Commit

Permalink
Support GHC 9.6.6 and API response fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nitinprakash96 committed Jul 7, 2024
1 parent 4a6f0e5 commit 12670cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions azure-auth/Azure/Types.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Azure.Types
( ExpiresOn
, AccessToken (..)
( AccessToken (..)
, Token
, newEmptyToken
, updateToken
Expand All @@ -13,8 +12,6 @@ import Data.Text (Text)
import UnliftIO (MonadIO (..), writeTVar)
import UnliftIO.STM (TVar, atomically, modifyTVar, newTVarIO, readTVarIO)

type ExpiresOn = Text

{- |
Data type representing a response body when GET request is made
using the Azure Instance Metadata Service (IMDS) endpoint.
Expand All @@ -29,17 +26,15 @@ data AccessToken = AccessToken
-- ^ The requested access token. When you call a secured REST API, the
-- token is embedded in the Authorization request header field as a @bearer@
-- token, allowing the API to authenticate the caller.
, atRefreshToken :: !Text
-- ^ Not used by managed identities for Azure resources.
, atExpiresIn :: !Integer
, atExpiresIn :: !Text
-- ^ The number of seconds the access token continues to be valid, before
-- expiring, from time of issuance. Time of issuance can be found in
-- the token's @iat@ claim.
, atExpiresOn :: !ExpiresOn
-- the token's @iat@ claim. This is represented as a string type.
, atExpiresOn :: !Text
-- ^ The timespan when the access token expires. The date is
-- represented as the number of seconds from @1970-01-01T0:0:0Z UTC@
-- (corresponds to the token's @exp@ claim).
-- NOTE: expires_on is a String version of unix epoch time, not an integer.
-- NOTE: @expires_on@ is a string version of unix epoch time, not an integer.
, atResource :: !Text
-- ^ The resource the access token was requested for, which
-- matches the resource query string parameter of the request.
Expand All @@ -52,7 +47,6 @@ data AccessToken = AccessToken
instance FromJSON AccessToken where
parseJSON = withObject "AccessToken" $ \o -> do
atAccessToken <- o .: "access_token"
atRefreshToken <- o .: "refresh_token"
atExpiresIn <- o .: "expires_in"
atExpiresOn <- o .: "expires_on"
atResource <- o .: "resource"
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-22.26 # based on ghc-9.6.5
resolver: lts-22.28 # based on ghc-9.6.6

packages:
- ./azure-auth
Expand Down

0 comments on commit 12670cd

Please sign in to comment.