Commit graph

32 commits

Author SHA1 Message Date
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
James Harton
c5f589058e
feat(OAuth2Authentication): Add support for generic OAuth2 endpoints. (#28) 2022-11-10 14:47:06 +13:00
James Harton
1d4bb00617
feat(Confirmation): Add extension that allows a user to be confirmed when created or updated. (#27) 2022-11-04 21:05:47 +13:00
James Harton
bab9ec363e
fix(PasswordReset): Generate the reset token using the target action, not the source action. (#25)
* fix(PasswordReset): Generate the reset token using the target action, not the source action.

Also improve tests.

* improvement(PasswordReset): rework PasswordReset to be a provider in it's own right - this means it has it's own routes, etc.
2022-11-04 11:24:33 +13:00
James Harton
6d4f338b0c
improvement(PasswordReset): A reset request is actually a query, not an update. (#23) 2022-11-03 14:03:14 +13:00
James Harton
0eca3274f0
feat(PasswordReset): allow users to request and reset their password. (#22) 2022-11-02 18:18:20 +13:00
James Harton
8797005175
feat(Ash.PlugHelpers): Support standard actor configuration. (#16)
* improvement(docs): change all references to `actor` to `user`.

The word "actor" has special meaning in the Ash ecosystem.

* chore: format `dev` directory also.

* feat(Ash.PlugHelpers): Support standard actor configuration.

* Adds the `:set_actor` plug which will set the actor to a resource based on the subject name.
* Also includes GraphQL and JSON:API interfaces in the devserver for testing.
2022-10-31 16:43:00 +13:00
James Harton
a939dde9b9
feat(PasswordAuthentication): Registration and authentication with local credentials (#4)
This is missing a bunch of features that you probably want to use (eg confirmation, password resets), but it's a pretty good place to put a stake in the sand and say it works.
2022-10-25 11:07:07 +13:00
17891fceda chore: Initial empty mix new. 2022-09-28 09:54:05 +13:00