-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The plugin now has the following features: - It's possible to use a 3rd-party OAuth provider. Additional configuration has been added to configure the details - It's possible to link all 3rd-party logins to the same Wordpress user. Especially useful if you only need to have the users logged in but don't care much about their identities (e.g. useful if you use a plugin such as "Force Login") - If there's only one provider defined *AND* you disable the default login form of Wordpress, the user will be automatically redirected to this provider. This esentially eliminates the Wordpress login page and relies on the 3rd-party provider only. For example, if you enable only Facebook, clicking on "Login" will take the user directly to Facebook "authorize application" page. - Lots of small fixes; e.g. admin page now has full width input boxes, which make long URLs much easier to handle.
- Loading branch information
Showing
4 changed files
with
114 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,21 +221,27 @@ function get_oauth_identity($wpoa) { | |
$oauth_identity = array(); | ||
$oauth_identity['provider'] = $_SESSION['WPOA']['PROVIDER']; | ||
/* | ||
Response example from Keycloack | ||
{ | ||
"name": "Admin User", | ||
"sub": "88dd0538-5f32-4222-af07-efe5cd809038", | ||
"preferred_username": "admin@ibxgaming.com", | ||
"preferred_username": "admin@example.com", | ||
"given_name": "Admin", | ||
"family_name": "User", | ||
"email": "[email protected]" | ||
} | ||
*/ | ||
$objtype = get_option('wpoa_custom_api_identity_id'); | ||
if ($objtype == null || $objtype == false || $objtype == '') { | ||
$objtype = 'id'; | ||
} | ||
$oauth_identity['id'] = $result_obj[$objtype]; | ||
$objtype = get_option('wpoa_custom_api_identity_preferred_username'); | ||
if ($objtype == null || $objtype == false || $objtype == '') { | ||
$objtype = 'preferred_username'; | ||
} | ||
$oauth_identity['id'] = $result_obj[$objtype]; // PROVIDER SPECIFIC: Google returns the user's OAuth identity as id | ||
//$oauth_identity['email'] = $result_obj['emails'][0]['value']; // PROVIDER SPECIFIC: Google returns an array of email addresses. To respect privacy we currently don't collect the user's email address. | ||
$oauth_identity['preferred_username'] = $result_obj[$objtype]; | ||
|
||
if (!$oauth_identity['id']) { | ||
// $wpoa->wpoa_end_login("Sorry, we couldn't log you in. User identity was not found: " . $_SESSION['WPOA']['ACCESS_TOKEN']); | ||
$wpoa->wpoa_end_login("Sorry, we could not log you in. User identity was not found. Please notify the admin or try again later."); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.