updated plugin OpenID Connect Generic version 3.11.3

This commit is contained in:
2026-06-03 21:29:12 +00:00
committed by Gitium
parent 44cba94bcb
commit 766faf9ed9
151 changed files with 8558 additions and 1213 deletions

View File

@ -33,15 +33,24 @@ class OpenID_Connect_Generic_Login_Form {
*/
private $client_wrapper;
/**
* The client object instance.
*
* @var OpenID_Connect_Generic_Client
*/
private $client;
/**
* The class constructor.
*
* @param OpenID_Connect_Generic_Option_Settings $settings A plugin settings object instance.
* @param OpenID_Connect_Generic_Client_Wrapper $client_wrapper A plugin client wrapper object instance.
* @param OpenID_Connect_Generic_Client $client A plugin client object instance.
*/
public function __construct( $settings, $client_wrapper ) {
public function __construct( $settings, $client_wrapper, $client ) {
$this->settings = $settings;
$this->client_wrapper = $client_wrapper;
$this->client = $client;
}
/**
@ -49,11 +58,12 @@ class OpenID_Connect_Generic_Login_Form {
*
* @param OpenID_Connect_Generic_Option_Settings $settings A plugin settings object instance.
* @param OpenID_Connect_Generic_Client_Wrapper $client_wrapper A plugin client wrapper object instance.
* @param OpenID_Connect_Generic_Client $client A plugin client object instance.
*
* @return void
*/
public static function register( $settings, $client_wrapper ) {
$login_form = new self( $settings, $client_wrapper );
public static function register( $settings, $client_wrapper, $client ) {
$login_form = new self( $settings, $client_wrapper, $client );
// Alter the login form as dictated by settings.
add_filter( 'login_message', array( $login_form, 'handle_login_page' ), 99 );
@ -136,9 +146,20 @@ class OpenID_Connect_Generic_Login_Form {
*/
public function make_login_button( $atts = array() ) {
// Use admin-configured button text, or fall back to default.
$default_button_text = ! empty( trim( $this->settings->login_button_text ?? '' ) )
? $this->settings->login_button_text
: __( 'Login with OpenID Connect', 'daggerhart-openid-connect-generic' );
$atts = shortcode_atts(
array(
'button_text' => __( 'Login with OpenID Connect', 'daggerhart-openid-connect-generic' ),
'button_text' => $default_button_text,
'endpoint_login' => $this->settings->endpoint_login,
'scope' => $this->settings->scope,
'client_id' => $this->settings->client_id,
'redirect_uri' => $this->client->get_redirect_uri(),
'redirect_to' => $this->client_wrapper->get_redirect_to(),
'acr_values' => $this->settings->acr_values,
),
$atts,
'openid_connect_generic_login_button'
@ -147,7 +168,16 @@ class OpenID_Connect_Generic_Login_Form {
$text = apply_filters( 'openid-connect-generic-login-button-text', $atts['button_text'] );
$text = esc_html( $text );
$href = $this->client_wrapper->get_authentication_url( $atts );
$href = $this->client_wrapper->get_authentication_url(
array(
'endpoint_login' => $atts['endpoint_login'],
'scope' => $atts['scope'],
'client_id' => $atts['client_id'],
'redirect_uri' => $atts['redirect_uri'],
'redirect_to' => $atts['redirect_to'],
'acr_values' => $atts['acr_values'],
)
);
$href = esc_url_raw( $href );
$login_button = <<<HTML