yesod-auth-oauth2/package.yaml
patrick brisbin ab17f214eb Consolidate all errors, use onErrorHtml
Prior to this commit, some errors would be thrown (missing parameter,
invalid state, incorrect approot) while others would be handled via the
set-message-redirect approach (handshake failure, fetch-token failure,
etc).

This commit consolidates all of these cases into a single DispatchError
type, and then uses MonadError (concretely ExceptT) to capture them all
and handle them in one place ourselves.

It then updates that handling to:

- Use onErrorHtml

  onErrorHtml will, by default, set-message-redirect. That make this
  behavior neutral for users running defaults. For users that have
  customized this, it will be an improvement that all our error cases
  now respect it.

- Provided a JSON representation of errors
- Attach a random correlation identifier

The last two were just nice-to-haves that were cheap to add once the
code was in this state.

Note that the use of MonadError requires a potentially "bad" orphan
MonadUnliftIO instance for ExceptT, but I'd like to see that instance
become a reality and think it needs some real-world experimentation to
get there, so here I am.
2021-03-05 11:41:29 -05:00

84 lines
1.8 KiB
YAML

---
name: yesod-auth-oauth2
version: "0.6.2.3" # N.B. PVP-compliant Semver: 0.MAJOR.MINOR.PATCH
synopsis: OAuth 2.0 authentication plugins
description: Library to authenticate with OAuth 2.0 for Yesod web applications.
category: Web
author:
- Tom Streller
- Patrick Brisbin
- Freckle Engineering
license: MIT
maintainer: engineering@freckle.com
github: freckle/yesod-auth-oauth2
homepage: http://github.com/freckle/yesod-auth-oauth2
extra-source-files:
- README.md
- CHANGELOG.md
ghc-options: -Wall
dependencies:
- base >=4.9.0.0 && <5
library:
source-dirs: src
dependencies:
- aeson >=0.6 && <1.6
- bytestring >=0.9.1.4 && < 0.12
- cryptonite >=0.25 && <0.29
- errors
- hoauth2 >=1.11.0 && <1.17
- http-client >=0.4.0 && <0.8
- http-conduit >=2.0 && <3.0
- http-types >=0.8 && <0.13
- memory
- microlens
- mtl
- safe-exceptions
- text >=0.7 && <2.0
- uri-bytestring
- yesod-auth >=1.6.0 && <1.7
- yesod-core >=1.6.0 && <1.7
- unliftio
executables:
yesod-auth-oauth2-example:
main: Main.hs
source-dirs: example
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- yesod-auth-oauth2
- aeson >=0.6 && <1.6
- aeson-pretty
- bytestring >=0.9.1.4 && < 0.12
- containers
- http-conduit >=2.0 && <3.0
- load-env
- text >=0.7 && <2.0
- warp
- yesod
- yesod-auth >=1.6.0 && <1.7
when:
- condition: ! "!(flag(example))"
buildable: false
tests:
test:
main: Spec.hs
source-dirs: test
dependencies:
- yesod-auth-oauth2
- hspec
- uri-bytestring
flags:
example:
description: Build the example application
manual: false
default: false