Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename OAuth2Error to TokenRequestError #168

Merged
merged 8 commits into from
Nov 11, 2022
Merged

Conversation

freizl
Copy link
Owner

@freizl freizl commented Nov 9, 2022

Description

Authorization Erorrs are not used at all hence doesn't seems beneficial to have data type (OAuth2Errors) that could accommodate both. Even it does (I missed use case), prefer being explicit that functions deal with Auth Request returns Auth Error, so as functions that deal with Token Request.
Hence for this PR

  • Removed OAuth2Error data type
  • Create TokenRequestError that is dedicated to handle token request errors.

Try to address #84

TODO

  • add unit test for parsing token error response

@freizl freizl merged commit f35f7be into main Nov 11, 2022
mirko-plowtech added a commit to plow-technologies/hoauth2 that referenced this pull request Feb 23, 2023
…by removing "qualified as" (#1)

* relax aeson to 2.1

* manual tweak nix and stack

* bump to houath2-2.5.0 and hoauth2-example-1.4.0

* sync nix file

* fix typo in cabal file

* Update description for tested OAuth2 providers.

* format cabal on the ghc-options; add sub for Auth0 user.

* Upgrade github actions

- upgrade github action
- nix build doesn't work well still. shall think of pin down to a version.

* format cabal files

* Dedeprate all *Internal method with *WithAuthMethod alternative

* remove Douban

* Add since annotation for new method.

* Update documentation; Move APIAuthMethod to HttpClient.

* Refactor http clien methods that only take one Auth method.

- Also remove `authPostBS1` which allow credential being sent in
multiple ways, which is not standard.
- Those are all Breaking changes.
- Fixes the compilation issue that caused by forgetting export APIAuthenticationMethod

* Fixes linkedin demo

* Update comment for ClientAuthenticationMethod.

* Refactor: run request method under MonadIO instead of IO

fixes freizl#147

* Adds helper method authorizationUrlWithParams

* v2 build is default now

* Rename hoauth2-example to hoauth2-demo

* Fixes build after rename

* Adding hoauth-tutorial as another example

* Fixes build error

* fixes hlint

* fixes base for tutorial main

* Fixes build failure

* Update the rewrite thoughts

* Fixes comments

* Add comment to OAuthToken fields

* Update tutorial

* make hoauth2-tutorial 0.1

* tweak hoauth2-tutorial

* Fixes comments

* Rename Hoauth2Tutorial.hs to HOAuth2Tutorial.hs

* Fixes hoauth2-tutorial to work with hoauth2-2.5.0

* bump hoauth2-tutorial-0.1.1

* Remove nonce

* support query parameter overrride in authorizationUrWithParams

* Change the type parameter order in http client JSON method

- It's more likely to apply type for JSON response than monad
- Hence move to first type parameter

* Add the oauth2 binding rewrite implementation and hoauth2 providers (freizl#155)


- The rewrite work resident at Network.OAuth2.Experiment module. See comments in the module for details.
- Adds package hoauth2-providers to for a list of common IdP providers, in terms of their OAuth2 endpoints, userinfo endpoint and the way to construct an Application. This package depends on the Experiment module
- Adds tutorial module for hoauth2-providers
- Updates hoauth2-demo application accordingly and add sample flow Resource Owner Password and Client Credential

* bump hoauth-2.6.0

* bump versions and change licence to MIT

release candidate for

- hoauth2@2.6.0
- hoauth2-demo@1.5.0
- hoauth2-providers@0.1
- hoauth2-providers-tutorial@0.1
- hoauth2-tutorial@0.1.2

* Update makefile

- fix the hlint task
- add publish task

* Update docs and notes

* move hoauth2-demo to new repo

* run dist before publish

* hoauth2-provider: refactor

- update developer page for IdPs
- rename DropboxName to DropboxUserName
- fixes the field comment for Google User

* Remove TODO to rename Facebook

- The social network brand isn't changed

* hoauth2-provider: add twitter

* move hoauth2-demo back; add twitter to demo app

* Adds comment to okta client credential app

* add ghcspecer but it doesn't for now

* :refactor: move to fourmolu

* fixes: surface up entire response body as string when response body is
empty when invoke API using access token

* refactor: rename ResourceOwner and ClientCredential idp config to idp application

* Add GrantType jwt-bearer (freizl#162)


- This is the grant type that google service account uses
- Spec https://www.rfc-editor.org/rfc/rfc7523.html#section-2.1

fixes freizl#16, freizl#51

* hard-code hoauth2 version in useragent header; format hoauth2.cabal.

* Omit internal modules from export/haddock

* Embedded version number dynamically is user agent string

* loose version for tutorial packages; add Paths_ autogen modules.

* Update oauth2 and user info endpoint for Azure

fixes freizl#165

* fixes hlint

* Add jwt authentication method for ClientCredential flow (freizl#163)


* Move google service account utilities to Provider.Google module
* move away from google-oauth-jwt by using HsOpenSSL and jose-jwt directly.
* re-purpose ClientSecret

* Format all src code by fourmolu

* Removes OAuth2Error and adds TokenRequestError (freizl#168)


Authorization Erorrs are not used at all hence doesn't seems beneficial to have data type (`OAuth2Errors`) that could accommodate both. Even it does (I missed use case), prefer being explicit that functions deal with Auth Request returns Auth Error, so as functions that deal with Token Request. So
- Removed `OAuth2Error` data type
- Create `TokenRequestError` that is dedicated to handle token request errors.

Also add unit test for token request error code and github action for unit test.

* Move HasIdpName class to hoauth2-demo (freizl#169)

fixes freizl#167

* bump to hoauth2-2.7; hoauth2-provider-0.2;

* fixes build due to hoauth-provider-0.2 bump

* :chore add restore key to github action

* Fixes the hoauth2 and hoauth2-provider boundary for others packages

* Fixes typo and a few refactor on documents (freizl#171)

* Update docs

* fixes typo in the example in Experiment.hs

* Fixes title of each hackage package

* a few tweaks

* format hackage badge

* update doc for hoauth-demo and quick fixes the path for env.json

* Rename readme.org to README.org

* change to unorder list

* Move idp guide to each module

* Move Provider.Utils to Data.ByteString.Contrib

* format files by fourmolu

* bump to text-2.0

* Specify hlint version

- to fix the runtime error

* ghc884 compatibility: Remove ImportQualifiedPost

---------

Co-authored-by: HW home <freizl@gmail.com>
Co-authored-by: Haisheng (mercury) <haisheng@mercury.com>
@freizl freizl deleted the feature/refactor-oauth2-error branch May 19, 2023 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant