API Authentication
June 29, 2024 at 4:56 AMnext_ad_int_auth
enable_login_check
next_ad_int_auth_enable_login_check (bool $enableLoginCheck) : bool $enableLoginCheck
Enable (or force disabling) the login check.
Description
The filter can be used to enable NADI’s login check on sites which do not use wp-login.php to log in.
For an example, visit this page.
Return value
bool $enableLoginCheck
If the login check should be triggered, you must return true. If you want the login check forced to be disabled, you must return false false. If your custom filter is executed but not responsible in the current call, just return the parameter $enableLoginCheck.
Parameters
bool $enableLoginCheck
By default this will be true if user is on wp-login.php or XML-RPC is executed.
configure_credentials
next_ad_int_auth_configure_credentials (NextADInt_Adi_Authentication_Credentials $credentials) : NextADInt_Adi_Authentication_Credentials $credentials
since 2.1.13
Description
Rewrite the credentials after a login has happened and before any connection to the AD is established.
Return value
NextADInt_Adi_Authentication_Credentials $credentials
A rewritten credentials. You could map a username to a completely different username with it.
Parameters
NextADInt_Adi_Authentication_Credentials $credentials
The credentials which has have been extracted from one of the $_SERVER['.*']
variables.
before_create_or_update_user
next_ad_int_auth_before_create_or_update_user
(NextADInt_Adi_Authentication_Credentials $credentials, array $ldapAttributes) : boolean $preCreateStatus (if false, leave createOrUpdateUser and return false to caller)
Description
This filter can be used in order to implement custom checks validating the ldapAttributes and credentials of the user currently trying to authenticate against your Active Directory.
Return value
bool $preCreateStatus
By default this will be true.
Parameters
NextADInt_Adi_Authentication_Credentials $credentials
Credentials object that holds several information about the user trying to authenticate. (Login name, password, etc)
array $ldapAttributes
Array that holds ldapAttributes information for the user trying to authenticate.
after_create_or_update_user
next_ad_int_auth_after_create_or_update_user (NextADInt_Adi_Authentication_Credentials $credentials, $adiUser, WP_User $wpUser) : boolean|WP_User
Description
This filter can be used in order to implement custom checks validating the credentials, ldapAttributes and $wpUser of the user currently trying to authenticate against your Active Directory. You can intercept the authentication process by returning false.
Return value
bool|WP_User $wpUser
By default this filter will return the provided $wpUser object.
Parameters
NextADInt_Adi_Authentication_Credentials $credentials
Credentials object that holds several information about the user trying to authenticate. (Login name, password, etc)
NextADInt_Adi_User $adiUser
NADI User object containing the user login, roleMappings and ldapAttributes for the user trying to authenticate against the Active Directory.
WP_User $wpUser
WordPress user object containing all the information about the user currently persisted within the WordPress database.
form_login_requires_ad_authentication
next_ad_int_auth_form_login_requires_ad_authentication(string $username) : boolean
since 2.3.0
Description
The hook is used for form-based logins only. It checks, if NADI is responsible for authenticating the user. By default, the filter checks the option Exclude usernames from authentication and if the WP_User of this username is a WordPress administrator account.
Return value
bool
true
if NADI is responsible for doing an authentication check, false
if not.
Parameters
string $username
Provided username of the user who wants to log in.
sso_login_requires_ad_authentication
next_ad_int_auth_sso_login_requires_ad_authentication(string $username) : boolean
since 2.3.0
Description
The hook is used for SSO-based logins only and does the same as next_ad_int_auth_form_login_requires_ad_authentication
. Please note that next_ad_int_auth_form_login_requires_ad_authentication
is not called when doing an SSO-based login.
Return value
bool
true
if NADI is responsible for doing an authentication check, false
if not.
Parameters
string $username
Provided username of the user who wants to log in.
login_succeeded_create_redirect_uri
next_ad_int_login_succeeded_create_redirect_uri(string $redirectUri = '') : string
since 2.3.3
Description
After a user has logged in, he will automatically be redirect to the given URI.
Return value
string
If empty, no redirection happens
Parameters
string $redirectUri
URI to redirect to
login_succeeded_exit_after_redirect
next_ad_int_login_succeeded_exit_after_redirect(bool $exit = true) : bool
since 2.3.3
Description
If this filter returns true, WordPress exits after sending the redirect via next_ad_int_login_succeeded_create_redirect_uri
.
Return value
bool
If true, it exists WordPress.
Parameters
string $exit
Exit WordPress or run other filters