You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For flarum administrators, if you're using an authentication extension that uses this extension, you can use the settings popup on the Flarum Admin extensions page to choose which types of attributes you'd like to sync.
28
+
## For Flarum Admins
29
29
30
-
Please note that in order to sync Bios and Masquerade Profile Fields, you need to install and enable the [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) and [Friends of Flarum Masquerade](https://github.com/FriendsOfFlarum/masquerade) extensions.
30
+
If you're using an authentication or auth-sync extension based on this extension
31
+
you can choose which types of attributes you'd like to sync on the extension settings page.
31
32
32
-
To use this extension in another authentication extension:
33
+
Note that in order to sync Bios and Masquerade Profile Fields, you need to install and enable the corresponding extensions:
33
34
34
-
1. Install the extension as dev dependency: `composer require liplum/sync-profile-core`.3
35
+
-[Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio)
36
+
-[Friends of Flarum Masquerade](https://github.com/FriendsOfFlarum/masquerade)
37
+
38
+
## For Extension Developers
39
+
40
+
To develop an authentication or auth-sync extension based on this extension, you should:
41
+
42
+
1. Install the extension as dev dependency: `composer require liplum/sync-profile-core`.
35
43
2. Inject `ExtensionManager $extensions` in your constructor.
36
44
3. Import the AuthEventSync model via `use Liplum\SyncProfile\Event\SyncProfileEvent;`
37
45
4. Before logging in/registering the user, create an AuthSyncEvent. Ex:
@@ -58,20 +66,21 @@ if ($this->extensions->isEnabled('liplum-sync-profile-core')) {
58
66
}
59
67
```
60
68
61
-
- Of course, replace the generic values above with attributes from your Identity Provider's response.
62
-
- Attributes should be provided in a json-encoded string (see above example). The JSON string should have the following attributes:
63
-
-`avatarUrl`: A URL pointing to an image for the user's avatar. Make sure that the file type is compatible with Flarum (jpeg or png I believe).
64
-
-`groups`: A comma-separated list of ids for groups that a user should belong to. Keep in mind that this will both add and remove groups, so make sure that all desired groups are included.
65
-
-`bio`: A string that will be synced to the user's bio if [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) is enabled
66
-
-`fof-masquerade`: An associative array for any masquerade keys and attributes you want to sync. Make sure that the key matches the name of the profile field exactly.
69
+
Replace the generic values above with attributes from your Identity Provider's response.
70
+
71
+
Attributes should be provided in a json-encoded string (see above example). The JSON string should have the following attributes:
72
+
73
+
-`nickname`: The display name of a user.
74
+
-`avatarUrl`: A URL pointing to an image for the user's avatar. Make sure that the file type is compatible with Flarum (jpeg or png I believe).
75
+
-`groups`: A comma-separated list of ids for groups that a user should belong to. Keep in mind that this will both add and remove groups, so make sure that all desired groups are included.
76
+
-`bio`: A string that will be synced to the user's bio if [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) is enabled
77
+
-`fof-masquerade`: An associative array for any masquerade keys and attributes you want to sync. Make sure that the key matches the name of the profile field exactly.
67
78
68
79
### TODO
69
80
70
81
- Add better validation and error handling.
71
82
- Add a setting to support default groups that all users should be added to, and groups that users should never be synced to.
72
-
- Add an expiry setting for Auth Sync Events.
73
83
- Add support for getting users via LoginProvider providers and identifiers, in addition to email.
74
-
- Due to a bug in flarum core, the `LoggedIn` event isn't dispatched when logging in via an external identity provider. Until this is fixed, the UserUpdatedListener listens to `Serialize` events (except those going to masquerade). This workaround will be promptly removed when the upstream bug is fixed.
0 commit comments