Commit Graph

314 Commits

Author SHA1 Message Date
patrick brisbin
20ff7feaac Add ClassLink plugin 2021-01-14 10:21:46 -05:00
patrick brisbin
2b88d736f1 Lint 2021-01-14 10:21:46 -05:00
patrick brisbin
7c8d3eac49
Version bump 2020-12-21 08:56:05 -05:00
patrick brisbin
2bf1bf7f21 Bump LTS, bump dependencies upper-bounds 2020-12-21 08:40:43 -05:00
patrick brisbin
8b0ad2c222 Update nightly CI 2020-12-21 08:40:43 -05:00
patrick brisbin
92bd62e051
Remove weeder from Makefile 2020-12-10 15:22:50 -05:00
patrick brisbin
3cf4a3e87b
Version bump 2020-12-10 15:22:02 -05:00
patrick brisbin
bbda0d2f47 Support injecting fetchAccessToken
hoauth2's fetchAccessToken provides credentials in the Authorization
header, while fetchAccessToken2 provides them in that header but also
the POST body.

It was discovered that some providers only support one or the other, so
using fetchAccessToken2 would be preferred since it should work with
either. This happened in #129.

However, we discovered at least one provider (Okta) that actively
rejects requests unless they're supplying credentials in exactly one
place:

    Cannot supply multiple client credentials. Use one of the following:
    credentials in the Authorization header, credentials in the post
    body, or a client_assertion in the post body."

This patch reverts back to fetchAccessToken, but makes it possible to
for client to use fetchAccessToken2 if necessary via alternative
functions.
2020-12-10 15:20:31 -05:00
patrick brisbin
1f6d08dc8b Brittany 2020-12-10 15:20:31 -05:00
patrick brisbin
5d78b889b0
Version bump 2020-09-04 16:57:47 -04:00
patrick brisbin
bfc4c7d469 Update CHANGELOG 2020-08-24 10:49:14 -04:00
patrick brisbin
c607417c99 Drop CI support for ghc-8.4
It seems newer hoauth2 uses newer Cabal, which doesn't work in the
resolver for ghc-8.4. It may build, and you're welcome to try, but we're
dropping formal (e.g. CI-backed) support here.
2020-08-24 10:49:14 -04:00
patrick brisbin
537c03796d Disable weeder on CI
Something funky going on with version and we seem to get weeder-2 in
some Jobs, but not others.
2020-08-24 10:49:14 -04:00
patrick brisbin
ebc12e49ff Lint ErrorResponse 2020-08-24 10:49:14 -04:00
patrick brisbin
cbe4aed1c8 Brittany ErrorResponse 2020-08-24 10:49:14 -04:00
patrick brisbin
845d8e654e Add setup.tools to Makefile 2020-08-24 10:49:14 -04:00
patrick brisbin
b95eddf84c fixup! Update to latest GHC, Stackage resolver, hoauth2 2020-08-24 10:49:14 -04:00
patrick brisbin
28d2113674 Update to latest GHC, Stackage resolver, hoauth2
- Update to ghc-8.8 / lts-16.0
- Update to hoauth2 >= 1.11.0

  - authGetBS has pre-encoded errors a v1.9
  - oauthClientSecret is Maybe at v1.11

- Tweak non-default Resolvers as required
2020-08-24 10:49:14 -04:00
patrick brisbin
2e3529cfdb Add watch target in Makefile 2020-08-24 10:49:14 -04:00
patrick brisbin
c939633a96 Reformat with Brittany 2020-08-24 10:49:14 -04:00
patrick brisbin
236d0f4b10 Tighten upper bound on hauth2
We need to avoid 1.9, where authGetBS changes type. This was the case
until 0036d5f, where it was changed unintentionally.

Fixes #135.
2020-08-23 13:47:10 -04:00
patrick brisbin
27cad251ab
Version bump 2020-08-20 12:12:30 -04:00
patrick brisbin
3cac6e2c34
Add example Makefile target 2020-08-20 12:11:23 -04:00
patrick brisbin
ce2a31e529
Add --fast to Makefile targets 2020-08-20 12:11:10 -04:00
patrick brisbin
46c5faf808 Update CHANGELOG 2020-08-20 11:38:20 -04:00
patrick brisbin
cd3875b797 Strengthen random state token generation
Previously:

- System.Random, which seeds from system time (possible attack)
- 30 characters, a-z (low entropy)

Now:

- Crypto.Random, accepted as "cryptographically secure"
- 64 random bytes, Base64-encoded

cryptonite was already a transitive dependency, so there is really no
downside to this.

Fixes #132.
2020-08-20 11:38:20 -04:00
patrick brisbin
e46da4cafb
Document bounds change 2020-08-19 11:18:19 -04:00
patrick brisbin
60c0f68d5a
Cleanup WordPress plugin
- Explicit exports
- Fixup Haddock formatting
- Brittany & Stylish
- CHANGELOG attribution
2020-08-19 11:17:22 -04:00
nbloomf
40119bd1f3 Update changelog 2020-08-19 10:57:14 -04:00
nbloomf
cc961a0288 Add WordPress.com to .env.example 2020-08-19 10:57:14 -04:00
nbloomf
13b84a8724 Add WordPress.com as an auth provider
Documentation at https://developer.wordpress.com/docs/wpcc/
2020-08-19 10:57:14 -04:00
patrick brisbin
e483abcbc0 Disable nightly builds for now 2020-08-19 10:56:37 -04:00
patrick brisbin
a635a51e8c Fix nightly build 2020-08-19 10:56:37 -04:00
patrick brisbin
0c53b2fcb8 Add nightly target to Makefile 2020-08-19 10:56:37 -04:00
patrick brisbin
e57f90bc2c Simplify Makefile, now that it's not used on CI 2020-08-19 10:56:37 -04:00
patrick brisbin
79c2ab3e93 Include examples in CI builds 2020-08-19 10:56:37 -04:00
patrick brisbin
b1e31e9623 Use stack-nightly in nightly CI build 2020-08-19 10:56:37 -04:00
patrick brisbin
96492707b9 Rewrite CI using stack-build Orb 2020-08-19 10:56:37 -04:00
nbloomf
1576af3fa5 Replace call to fetchAccessToken with fetchAccessToken2
This comment comes from hoauth2:

-- OAuth2 spec allows `client_id` and `client_secret` to
-- either be sent in the header (as basic authentication)
-- OR as form/url params.
-- The OAuth server can choose to implement only one, or both.
-- Unfortunately, there is no way for the OAuth client (i.e. this library) to
-- know which method to use. Please take a look at the documentation of the
-- service that you are integrating with and either use `fetchAccessToken` or `fetchAccessToken2`

`fetchAccessToken2` is a drop-in replacement for `fetchAccessToken` that just adds `client_id` and `client_secret` to the body as form parameters, as permitted by [RFC 6749](https://tools.ietf.org/html/rfc6749#section-2.3.1). Some authorization server implementations only accept client credentials in this form.
2020-07-08 10:15:40 -04:00
nbloomf
0036d5f4e0 Bump version bounds for dependency hoauth2
We're about to replace the call to `fetchAccessToken` from hoauth2 by `fetchAccessToken2`, which was introduced in 1.7.0 and amended in 1.11.0, to allow for oauth2 implementations that expect POST token payloads. Either the initial or the amended version of `fetchAccessToken2` would work for this, but here we've chosen the most conservative working version bump.
2020-07-08 10:15:40 -04:00
nbloomf
b49ccb13aa Add AzureAD to example app 2020-07-08 05:45:27 -04:00
nbloomf
f6b9a28c29 Add GitLab to .env.example 2020-07-08 05:45:27 -04:00
patrick brisbin
036458c7a8 Build Cabal in -j 1 step
Un-cached builds cannot succeed without exhausting memory. Doing fewer
packages concurrently can sometimes resolve this. This is trial and
error.

https://app.circleci.com/jobs/github/thoughtbot/yesod-auth-oauth2/1022
2020-01-27 10:38:32 -05:00
patrick brisbin
b998e03067 Brittany 2019-12-03 20:27:15 -05:00
patrick brisbin
48277d9b8e Compile on nightly/ghc-8.8 2019-12-03 20:27:15 -05:00
patrick brisbin
5528bb9d07
Version bump 2019-08-29 17:23:21 -04:00
patrick brisbin
8436c8ff27 Don't handle unexpected errors with Unknown
This was lazy and resulted in a confusing error experience where a
JSONDecodingError fetching credentials appeared as an Unknown OAuth2
ErrorResponse, making it appear like the OAuth2 provider was indicating
this error to us, instead of it being a simple incorrect parser in our
own code.

ErrorResponse is specifically meant to parse error parameters sent to us
by the OAuth2 provider. They may be user-actionable and can be safely
displayed. This is a very narrow use-case. The Unknown constructor is
required for us to be exhaustive on our string error names, but it
should not be hijacked to store our own errors.

This commit separates and documents the two error scenarios.
2019-08-29 17:21:28 -04:00
patrick brisbin
9c6ac9b59d Fix for weeder and stack-2 2019-08-29 17:21:28 -04:00
patrick brisbin
6fa9748de8 Commit stack.yaml.lock
In version 2, Stack creates this file and it should be checked into
version control to ensure consistent builds across the team, just like a
yarn.lock or Gemfile.lock.
2019-08-29 17:21:28 -04:00
patrick brisbin
4f1de3eb85
Version bump 2019-03-09 09:16:17 -05:00