Commit Graph

28 Commits

Author SHA1 Message Date
Natalie Tay f11229a511
FIX: Appropriately assign values when fetching user details (#100)
FIX: Appropriately assign values when fetching user details
2024-03-21 17:41:02 +08:00
Natalie Tay 895db120e3
FEATURE: Allow specifiying required paths when retrieving userinfo (#96)
When retrieving userinfo with oauth2_fetch_user_details=true, we sometimes want to disallow account creation if an attribute is not fulfilled.

This commit adds a new register oauth2_basic_required_json_path which will kick in when retrieving userinfo.
2024-01-31 20:19:18 +08:00
Leonardo Mosquera d1161b99a7
FIX: do not attempt to fetch user JSON if URL is not set (#94)
It is a configuration error to set oauth2_fetch_user_details to true but leave oauth2_user_json_url empty.

Before, this resulted in an unhandled exception in core. Now it is checked here.
2024-01-24 18:50:52 -03:00
Jarek Radosz 05cefd5ecd
DEV: Update linting (#93) 2024-01-16 18:00:23 +01:00
Ted Johansson 829fc31037
DEV: Replace deprecated queue_jobs site setting in tests (#88)
The #queue_jobs= method on site settings has been deprecated and replaced by Jobs.run_later! and Jobs.run_immediately!. This PR replaces usages in this plugin so we can remove the fallback in core.
2023-10-27 10:47:12 +08:00
David Taylor ccf9d5d32c
DEV: Introduce syntax_tree for ruby formatting (#75) 2022-12-29 13:33:21 +01:00
David Taylor 2efe6578ce
DEV: Bump rubocop-discourse (#71)
* DEV: Bump rubocop-discourse

* Fix rubocop violations
2022-10-03 22:20:41 +02:00
Jarek Radosz 38f527fafa
DEV: General cleanup (#65) 2022-04-06 12:19:44 +02:00
David Taylor d615a7504d
DEV: Make overrides_email an integration spec (#56)
We're moving the location of the email-overriding logic in https://github.com/discourse/discourse/pull/15378, which makes the old unit test in this plugin fail. This commit makes it an integration test, so that it's more robust against core changes, and will continue to pass before and after the core changes.
2021-12-23 10:29:04 +00:00
Angus McLeod 2303143266
DEV: Update plugin_spec (#53) 2021-11-24 10:38:12 +00:00
Roman Rizzi 96d815c56c
DEV: Restos skipped test. Plugins can reset a single registry now. follow-up to 3e3c2ae (#50) 2021-07-02 13:38:59 -03:00
Alan Guo Xiang Tan 3e3c2ae44d
DEV: Skip test that is resetting state of other plugins. (#48)
Follow-up to d1a912ebc8
2021-07-02 16:16:03 +08:00
Roman Rizzi d1a912ebc8
FEATURE: Fetch custom attributes from the user details. (#47)
Other plugins can tell the authenticator to traverse the user details JSON using custom paths and store the values in the user associated account extra field.
2021-07-01 18:23:27 -03:00
David Taylor f45cd3edf9
FEATURE: Handle invalid email_verified data from identity provider (#40)
Some identity providers send email_verfied as a 'true'/'false' string, not a boolean. (e.g. this bug in Auth0: https://community.auth0.com/t/27553)

This commit adds automatic handling for this case, so that the string is automatically converted into a real boolean.
2021-04-21 11:16:25 +01:00
David Taylor 96a0bde0aa
FEATURE: Allow JSON paths with literal dots in the keys (#33)
This is achieved by surrounding a key with double quotes, or by escaping
the dot character with a backslash.

For example, given the JSON

```
{ "www.example.com/uid": "myuid" }
```

Previously, there was no way to access this value. The dots would make
the parser try to access `json["www"]["example"]["com/uid"]`.

Now, this value can be accessed by using a `oauth2_json_user_id_path` like:

```
www\.example\.com/uid
```
or alternatively:
```
"www.example.com/uid"
```
2021-03-10 11:48:58 +00:00
Josh Kerxhalli-Kleinfield ca5f555750
FEATURE: Allow using array indexes in json paths (#22) 2020-04-21 14:46:42 +01:00
David Taylor 47a8211d9a
DEV: Correct OAuth2BasicAuthenticator namespace, remove spec workarounds 2020-04-14 21:32:35 +01:00
Penar Musaraj e49eb3bd9f Make Rubocop happy 2019-07-29 21:32:27 -04:00
Angus McLeod 5ae9f35e81 FEATURE: Migrate to ManagedAuthenticator (#21)
This brings the plugin in-line with recent core improvements. Advantages include

- Account-linking logic and storage is shared between all authentication providers
- Optionally, users can be allowed to disconnect/reconnect their accounts
- The 'last used' date of an association is recorded
- Association metadata is recorded in the database for use in data explorer and other plugins

Data migration will be performed automatically, and all existing functionality is maintained.
2019-07-27 16:34:17 +01:00
Angus McLeod eb31cdf44f Handle fetch user details failure (#20)
* handle failure in get_user_details request

* add spec

* improve spec

* return nil on failure
2019-07-11 10:31:51 -04:00
Angus McLeod a634ff896d Use token callback user details (#18)
* Add way to use user details returned in token response

* Add spec

* Apply suggestions from code review

Co-Authored-By: Robin Ward <robin.ward@gmail.com>
2019-07-05 10:27:07 -04:00
Angus McLeod ef5b3ee1ff FEATURE: Allow provider to set email verification state (#17) 2019-06-26 11:03:52 +01:00
Guo Xiang Tan 5a459fbb6e Add frozen string literal comment to files. 2019-05-13 10:49:26 +08:00
David Taylor 722fe23b4e FEATURE: Add site setting to override user email address during login 2019-03-26 20:38:46 +00:00
David Taylor 090f63c429 FIX: Download avatar for new users
Previously avatars were only loaded on subsequent logins
2019-02-05 14:53:34 +00:00
misaka4e21 f603604caa
FEATURE: Support avatar retrieval. 2018-05-25 14:34:50 +08:00
Blake Erickson bce6e9e878 ADD: can now walk json that contains arrays
I feel like this is kind of a hack to handle a change with Auth0 where
the actual user id is inside of an array of identities. While I do think
it would be good to build an actual plugin for Auth0 to better handle
their use case I do feel that it is important that we can handle Auth0
with this plugin for now.
2018-05-16 14:53:10 -06:00
Leo McArdle f0151cdea6 add spec 2017-09-06 23:15:10 +01:00