Commit graph

58 commits

Author SHA1 Message Date
578a353d17
chore: Update test repo to match AshPostgres requirements. 2024-09-02 09:16:19 +12:00
Zach Daniel
c4f570380f
fix: allow overriding strategy defaults (#766) 2024-08-18 18:16:28 -04:00
Antonio
c9d12076ce
Actually use 'trusted_audiences' in oauth2 strategy. (#770) 2024-08-15 17:30:17 -04:00
Zach Daniel
652983be5a chore: fix errors from previous commit 2024-08-09 09:37:42 -04:00
Zach Daniel
3562aea431 improvement: use no_depend_modules for better compile dependencies 2024-08-08 13:34:36 -04:00
dependabot[bot]
9b9f11c3f0
chore(deps): Bump the production-dependencies group across 1 directory with 4 updates (#755)
* chore(deps): Bump the production-dependencies group across 1 directory with 4 updates

Bumps the production-dependencies group with 2 updates in the / directory: [ash](https://github.com/ash-project/ash) and [ash_postgres](https://github.com/ash-project/ash_postgres).


Updates `ash` from 3.0.16 to 3.3.2
- [Changelog](https://github.com/ash-project/ash/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ash-project/ash/compare/v3.0.16...v3.3.2)

Updates `ash_postgres` from 2.0.12 to 2.1.17
- [Changelog](https://github.com/ash-project/ash_postgres/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ash-project/ash_postgres/compare/v2.0.12...v2.1.17)

Updates `jason` from 1.4.3 to 1.4.4
- [Release notes](https://github.com/michalmuskala/jason/releases)
- [Changelog](https://github.com/michalmuskala/jason/blob/v1.4.4/CHANGELOG.md)
- [Commits](https://github.com/michalmuskala/jason/compare/v1.4.3...v1.4.4)

Updates `spark` from 2.2.7 to 2.2.11
- [Changelog](https://github.com/ash-project/spark/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ash-project/spark/compare/v2.2.7...v2.2.11)

---
updated-dependencies:
- dependency-name: ash
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: production-dependencies
- dependency-name: ash_postgres
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: production-dependencies
- dependency-name: jason
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-dependencies
- dependency-name: spark
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: fix formatting, etc.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Harton <james@harton.nz>
2024-08-05 15:19:10 +12:00
Simon Bergström
866d806b47
improvement: compile-time check to make sure that the configured token_resource is an Ash.Resource (#749)
* improvement(Tokens): improved compile-time validation of the token_resource option of the tokens DSL by checking that the passed value is an Ash.Resource.

* improvement(Tokens): removed unnecessary stuff from the test file.

* improvement(Tokens): fixed credo warning and changed some things after PR feedback
2024-07-24 16:21:24 -04:00
Zach Daniel
a79a474b11
fix: only pass the "token" parameter to reset with token action (#748) 2024-07-22 15:44:36 -04:00
81236e1ed5
fix: correctly generate sign-in tokens when requested. 2024-06-06 14:34:30 +12:00
4e66a402fe
improvement: Only require tokens to be enabled when using a strategy which needs them. 2024-05-10 14:38:09 +12:00
Zach Daniel
8070e011cd chore: add ash-functions for tests 2024-04-25 22:29:17 -04:00
Martin Schut
8721c01b4c
improvement(OIDC): Adjust dsl of OIDC reflect assent requirements (#538)
The OIDC implementation of assent requires the base_url to be set and ignores the different *_url attributes. At favours the returned configuration from the openid_configuration_uri. To not configure some unused attributes they're removed.
2024-04-12 09:22:58 +12:00
d697e0313d
fix(Strategy.Password): Reset tokens are single use. (#625)
When a token is successfully used to reset a password then it is immediately revoked so that it cannot be used again.

Closes #624.
2024-04-10 11:26:55 +12:00
c22439f48f
fix(Confirmation): Only allow the confirmation token to be used once. (#623)
Fixes a potential issue where the confirmation token can be used multiple times, potentially opening a replay attack.

Closes #618
2024-04-09 09:32:37 +12:00
de9ef14b2e
improvement: re-integrate ash_graphql and ash_json_api RCs. 2024-04-02 09:23:30 +13:00
f0075e2cd3
improvement!: Update to support Ash 3.0. (#599) 2024-03-28 14:44:23 +13:00
dependabot[bot]
408a28ccf4
chore(deps): Bump assent from 0.2.7 to 0.2.8 (#506)
* chore(deps): Bump assent from 0.2.7 to 0.2.8

Bumps [assent](https://github.com/pow-auth/assent) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/pow-auth/assent/releases)
- [Changelog](https://github.com/pow-auth/assent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pow-auth/assent/compare/v0.2.7...v0.2.8)

---
updated-dependencies:
- dependency-name: assent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(OAuth2): Reflect `assent` `site` -> `base_url` change.

I considered just rewriting it behind the scenes, but I think it's probably better in the long run if we just emit a deprecation.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Harton <james@harton.nz>
2023-11-22 10:49:07 +13:00
7b607896eb
improvement: Allow all token lifetimes to be specified with a time unit.
Now any DSL option which allows the configuring of a token lifetime
can take _either_ a positive integer in it's previous default unit
or a tuple containing a positive integer and a unit.

Closes #376.

Additionally includes switching the resettable entity to being a singleton since that
feature didn't exist when I started.
2023-09-22 12:15:47 +12:00
Alan Heywood
ee7c0db007
improvement: assign the token record to the connection assigns (#426) 2023-09-20 14:08:57 +12:00
Zach Daniel
575785c3f2
docs: remove registries from docs and examples (#388) 2023-08-16 19:58:48 +12:00
Zach Daniel
dd622d769d chore: update ash_graphql, remove deprecated function 2023-06-12 23:08:00 -04:00
James Harton
53ff256391
feat: OpenID Connect Strategy (#197)
* feat(AshAuthentication.Strategy.Oidc): Add OpenID Connect strategy.

* chore(CI): disable the workflow on pull request event, since it's covered by push.
2023-05-04 13:15:24 +12:00
Robert Graff
2c4d8b296f
fix: PasswordValidation should associate errors with the field being … (#279) 2023-04-28 15:20:02 -04:00
Zach Daniel
eca8cadea0
improvement: add sign in tokens to password strategy (#252)
* improvement: add sign in tokens to password strategy

* chore: update `.formatter.exs`.

* chore: fix credo warnings.

* improvement: convert `sign_in_with_token` into an action.

---------

Co-authored-by: James Harton <james@harton.nz>
2023-04-06 14:53:44 +12:00
0cd431d4d0 fix: fix failing JWT tests because of bad version regex. 2023-03-07 09:51:33 +13:00
Zach Daniel
7f1c9678e4
feat!: Configure accepted fields on register (#219) 2023-03-04 01:44:34 -05:00
Hannes Wüthrich
65e848c5e0
fix: sign in preparation without identity resource (#198) 2023-02-20 10:02:04 +13:00
Zach Daniel
a2bba519c0
improvement: add select_for_senders (#189)
* improvement: add select_for_senders
fix: select `hashed_password` on sign in preparation

* improvement: include metadata declaration on register action

* chore: fix typo
2023-02-12 21:15:23 +13:00
James Harton
ca3dac3878
fix: don't allow special purpose tokens to be used for sign in. (#191)
This fixes a security issue where someone in possession of a special purpose token (reset, confirmation, magic link, etc) would be able to access an API using this token.  We strongly encourage you to upgrade.

Closes #190.
2023-02-12 21:14:16 +13:00
James Harton
cf3d227ef2
feat: Add new "magic link" authentication strategy. (#184) 2023-02-09 21:05:49 +13:00
James Harton
3bece5f657
improvement(Strategy.Custom): handle custom strategies as extensions. (#183)
This means that users can add their own extensions to their resources which patch the strategy (and add ons) DSLs.
2023-02-08 16:10:28 +13:00
James Harton
7e639e4a21
feat: Add support and documentation for custom strategies. (#154) 2023-01-30 13:16:37 +13:00
James Harton
d4f3bec947
feat(PasswordValidation): Add a validation which can check a password. (#144) 2023-01-18 14:46:22 +13:00
James Harton
948298ac1c
improvement(TokenResource)!: Store the token subject in the token resource. (#133)
* improvement(TokenResource)!: Store the token subject in the token resource.

This is a breaking change because you may have to delete tokens in your database so that you can avoid the non-null constraint on subject.

* docs: Add upgrading documentation.
2023-01-13 17:21:57 +13:00
James Harton
085d640c44
fix(Confirmation): send the original changeset to confirmation senders. (#132)
Changes the behaviour of the `ConfirmationHookChange` to pass the original, unmodified changeset in the sender options so that senders can account for inhibited changes.
2023-01-13 13:30:58 +13:00
James Harton
4129aa969a
feat(GitHub)!: Add GitHub authentication strategy. (#125) 2023-01-12 17:23:40 +13:00
James Harton
500ea353a8
fix(Confirmation): correctly generate confirmation token subjects. (#124) 2023-01-12 13:49:48 +13:00
James Harton
d5c5d6b6c5
feat: Add token-required-for-authentication feature. (#116)
* Adds the `require_token_presence_for_authentication?` DSL option to the Authentication extension which when enabled changes the following behaviour:
  1. The `store_in_session` plug will store the user's token rather than their subject in the session.
  2. The `retrieve_from_session` plug will look for a stored token in the session rather than a subject and ensure that it's present in the `TokenResource`.
  3. The `retrieve_from_bearer` plug will ensure that the token is present in the `TokenResource`.
* Adds the `get_token` action to the `TokenResource`.
2023-01-11 15:12:53 +13:00
James Harton
792ec056b8
feat: Make strategy names optional where possible. (#113) 2023-01-09 15:02:48 +13:00
James Harton
5ba5e163f3
improvement: Allow the strategy name to be passed for password validations and changes. (#102)
After #89 was merged folks were no longer able to use `AshAuthentication.Strategy.Password.HashPasswordChange` and `AshAuthentication.Strategy.Password.PasswordConfirmationValidation` in their own actions.  This change fixes this issue by allowing the name of the strategy to be passed in in the changeset context.
2023-01-09 09:27:50 +13:00
James Harton
cf9ad01dd5
feat(Auth0): Add a pre-configured Auth0 strategy. (#99) 2022-12-16 13:06:51 +13:00
James Harton
f1cd72407a
feat: Add option to store all tokens when they're created. (#91) 2022-12-14 15:06:13 +13:00
James Harton
6dfbf03f11
improvement: remove the need for a strategy in changeset/query contexts. (#89)
The action -> strategy mapping is now stored directly in the resource DSL.

Closes #84.
2022-12-13 16:35:30 +13:00
371a6ad821 improvement(Jwt)!: Use token signing secret into the DSL.
Use the `AshAuthentication.Secret` behaviour, rather than asking the user to explicitly set it in their application environment.

This is a breaking change that will require folks to change their resource config to look up the signing secret.

Closes #79.
Closes #77.
2022-12-12 10:45:28 +13:00
James Harton
2cee21c9ed
improvement(actions): All actions now take optional arguments for the underlying API call. (#61)
Closes #37.
2022-12-05 13:04:42 +13:00
5febe36527 improvement(Confirmation): Store confirmation changes in the token resource.
This prevents possible PII leakage as per #47.
2022-12-05 10:48:23 +13:00
776bd8ea6c improvement(TokenResource)!: Move TokenRevocation -> TokenResource.
This paves the way to fix #47.
2022-12-01 08:41:49 +13:00
James Harton
e88a516b22
improvement(Confirmation): Confirmation is not a strategy. (#46)
* improvement(Confirmation): Confirmation is not a strategy.

* improvement(Confirmation): Support more than one confirmation entity.

* chore: move FIXME doc to issue.
2022-11-24 16:40:15 +13:00
James Harton
1c8f138c67
improvement!: Major redesign of DSL and code structure. (#35)
Highlights:

* Replaced `AshAuthentication.Provider` with the much more flexible `AshAuthentication.Strategy`.
* Moved strategies to within the `authentication` DSL using entities and removed excess extensions.
* Added a lot more documentation and test coverage.
2022-11-23 09:09:41 +13:00
James Harton
65d53e3597 improvement(OAuth2Authentication)!: Make the site option runtime configurable. (#31) 2022-11-15 14:46:42 +13:00