Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/amazonka/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

### Fixed

- `amazonka`: Attempt to load credentials in the correct order. In particular, this means that the IMDS is queried last and is once again consistent with other SDKs.
[\#1029](https://github.com/brendanhay/amazonka/pull/1029)
- `.cabal` files name the source repository with a `https://` URL, not a `git://` one (thanks @marinelli)
[\#1026](https://github.com/brendanhay/amazonka/pull/1026)
- `amazonka-*`: GHC 9.8 support
Expand Down
14 changes: 3 additions & 11 deletions lib/amazonka/src/Amazonka/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ import Amazonka.EC2.Metadata
import Amazonka.Env (Env, Env' (..), EnvNoAuth)
import Amazonka.Prelude
import Amazonka.Types
import Control.Exception (fromException)
import Control.Monad.Catch (MonadCatch (..), catchJust, throwM)
import Control.Monad.Catch (MonadCatch (..), throwM)

-- | Attempt to fetch credentials in a way similar to the official AWS
-- SDKs. The <https://github.com/aws/aws-sdk-cpp/blob/fb8cbebf2fd62720b65aeff841ad2950e73d8ebd/Docs/Credentials_Providers.md#default-credential-provider-chain C++ SDK>
Expand Down Expand Up @@ -127,12 +126,5 @@ runCredentialChain :: (MonadCatch m) => [a -> m b] -> a -> m b
runCredentialChain chain env =
case chain of
[] -> throwM CredentialChainExhausted
provider : chain' -> do
cJust
fromException
(runCredentialChain chain' env)
(const $ provider env)
where
-- Required so that the compiler knows enough about 'e' to use our prism.
cJust :: (MonadCatch m, AsAuthError e, Exception e) => (e -> Maybe AuthError) -> m a -> (AuthError -> m a) -> m a
cJust = catchJust
provider : chain' ->
provider env `catch` \(_ :: AuthError) -> runCredentialChain chain' env
Loading