LimeSurvey API - Master branch

SmtpOAuthPluginBase extends EmailPluginBase
in package

AbstractYes

Table of Contents

Constants

SETUP_STATUS_INCOMPLETE_CREDENTIALS  = 3
SETUP_STATUS_INVALID_REFRESH_TOKEN  = 5
SETUP_STATUS_MISSING_REFRESH_TOKEN  = 4
SETUP_STATUS_REQUIREMENT_UNMET  = 2
SETUP_STATUS_VALID_REFRESH_TOKEN  = 1

Properties

$credentialAttributes  : array<string|int, string>

Methods

afterReceiveOAuthResponse()  : mixed
Default handler for the afterReceiveOAuthResponse event
beforeRedirectToAuthPage()  : mixed
Default handler for beforeRedirectToAuthPage
getHealthStatusText()  : mixed
getPluginSettings()  : mixed
MailerConstruct()  : mixed
Default handler for the MailerConstruct event, triggered during LimeMailer initialization.
saveSettings()  : mixed
afterRefreshTokenRetrieved()  : mixed
This method is invoked after the refresh token is retrieved.
clearRefreshToken()  : mixed
Clears the stored refresh token
getAuthorizationOptions()  : array<string, mixed>
Returns the OAuth options for authorization (like the scope)
getCredentials()  : array<string, mixed>
Returns the credentials according to the plugin specified credential attributes
getDisplayName()  : string
Returns the plugin's display name
getEmailPluginInfo()  : EmailPluginInfo
Returns the plugin's metadata
getHealthStatusClass()  : mixed
getHealthStatusIcon()  : mixed
getOAuthConfigForMailer()  : array<string, mixed>|null
Returns the OAuth configuration for PHPMailer
getProvider()  : AbstractProvider
Returns the OAuth provider object for the specified credentials
getRedirectUri()  : mixed
getSetupStatus()  : mixed
Returns the setup status of the plugin.
getSetupStatusAlert()  : string
Renders the contents of the "information" setting depending on settings and token validity.
getSetupStatusDescription()  : mixed
haveCredentialsChanged()  : mixed
Returns true if the credentials have changed
isActive()  : bool
Returns true if the plugin is active
isCurrentEmailPlugin()  : bool
Returns true if the plugin is the currently selected email plugin
saveRefreshToken()  : mixed
Saves the specified refresh token and associated credentials
setupMailer()  : mixed
Applies the basic OAuth configuration to the given LimeMailer
validateCredentials()  : bool
Checks if the credentials are valid.
validateRefreshToken()  : bool
Returns true if the specified refresh token is valid
retrieveRefreshToken()  : mixed
Retrieve and store the refresh token

Constants

SETUP_STATUS_INCOMPLETE_CREDENTIALS

public mixed SETUP_STATUS_INCOMPLETE_CREDENTIALS = 3

SETUP_STATUS_INVALID_REFRESH_TOKEN

public mixed SETUP_STATUS_INVALID_REFRESH_TOKEN = 5

SETUP_STATUS_MISSING_REFRESH_TOKEN

public mixed SETUP_STATUS_MISSING_REFRESH_TOKEN = 4

Properties

$credentialAttributes

protected array<string|int, string> $credentialAttributes = []

The names of attributes that form part of the credentials set. Example: ['clientId', 'clientSecret']

Methods

afterReceiveOAuthResponse()

Default handler for the afterReceiveOAuthResponse event

public afterReceiveOAuthResponse() : mixed

beforeRedirectToAuthPage()

Default handler for beforeRedirectToAuthPage

public beforeRedirectToAuthPage() : mixed

getPluginSettings()

public getPluginSettings([mixed $getValues = true ]) : mixed
Parameters
$getValues : mixed = true
Tags
inheritdoc

MailerConstruct()

Default handler for the MailerConstruct event, triggered during LimeMailer initialization.

public MailerConstruct() : mixed

The event is expected to be dispatched specifically for the selected email plugin.

saveSettings()

public saveSettings(mixed $settings) : mixed
Parameters
$settings : mixed
Tags
inheritdoc

Handle changes in credentials

afterRefreshTokenRetrieved()

This method is invoked after the refresh token is retrieved.

protected afterRefreshTokenRetrieved(AbstractProvider $provider, AccessTokenInterface $token) : mixed

The default implementation tries to retrieve the email address of the authenticated user. You may override this method to do additional processing.

Parameters
$provider : AbstractProvider
$token : AccessTokenInterface

clearRefreshToken()

Clears the stored refresh token

protected clearRefreshToken() : mixed

getAuthorizationOptions()

Returns the OAuth options for authorization (like the scope)

protected abstract getAuthorizationOptions() : array<string, mixed>
Return values
array<string, mixed>

getCredentials()

Returns the credentials according to the plugin specified credential attributes

protected getCredentials() : array<string, mixed>
Tags
throws
Exception

if credentials are incomplete.

Return values
array<string, mixed>

The credentials array

getDisplayName()

Returns the plugin's display name

protected abstract getDisplayName() : string
Return values
string

getHealthStatusClass()

protected getHealthStatusClass(mixed $setupStatus) : mixed
Parameters
$setupStatus : mixed

getHealthStatusIcon()

protected getHealthStatusIcon(mixed $statusClass) : mixed
Parameters
$statusClass : mixed

getOAuthConfigForMailer()

Returns the OAuth configuration for PHPMailer

protected abstract getOAuthConfigForMailer() : array<string, mixed>|null
Return values
array<string, mixed>|null

getProvider()

Returns the OAuth provider object for the specified credentials

protected abstract getProvider(array<string, mixed> $credentials) : AbstractProvider
Parameters
$credentials : array<string, mixed>
Return values
AbstractProvider

getSetupStatus()

Returns the setup status of the plugin.

protected getSetupStatus() : mixed

getSetupStatusAlert()

Renders the contents of the "information" setting depending on settings and token validity.

protected getSetupStatusAlert() : string
Return values
string

getSetupStatusDescription()

protected getSetupStatusDescription(mixed $setupStatus) : mixed
Parameters
$setupStatus : mixed

haveCredentialsChanged()

Returns true if the credentials have changed

protected haveCredentialsChanged(mixed $oldCredentials, mixed $newCredentials) : mixed
Parameters
$oldCredentials : mixed
$newCredentials : mixed

isActive()

Returns true if the plugin is active

protected isActive() : bool
Return values
bool

isCurrentEmailPlugin()

Returns true if the plugin is the currently selected email plugin

protected isCurrentEmailPlugin() : bool
Return values
bool

saveRefreshToken()

Saves the specified refresh token and associated credentials

protected saveRefreshToken(mixed $refreshToken, mixed $credentials) : mixed
Parameters
$refreshToken : mixed
$credentials : mixed

setupMailer()

Applies the basic OAuth configuration to the given LimeMailer

protected setupMailer(LimeMailer $mailer) : mixed
Parameters
$mailer : LimeMailer

validateCredentials()

Checks if the credentials are valid.

protected validateCredentials(array<string, mixed> $credentials) : bool

By default, it checks if the credentials are not empty.

Parameters
$credentials : array<string, mixed>
Return values
bool

True if the credentials are valid, false otherwise.

validateRefreshToken()

Returns true if the specified refresh token is valid

protected validateRefreshToken(string $refreshToken, array<string, mixed> $credentials) : bool
Parameters
$refreshToken : string
$credentials : array<string, mixed>
Return values
bool

retrieveRefreshToken()

Retrieve and store the refresh token

private retrieveRefreshToken(mixed $code, mixed $credentials) : mixed
Parameters
$code : mixed
$credentials : mixed

        
On this page

Search results