VuFind API Documentation

ILSAuthenticator
in package
implements DbServiceAwareInterface Uses DbServiceAwareTrait

Class for managing ILS-specific authentication.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Page

Interfaces, Classes, Traits and Enums

DbServiceAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Service\PluginManager

Table of Contents

$authManager  : Manager
Authentication manager
$authManagerCallback  : callable
Callback for retrieving the authentication manager
$catalog  : Connection
$config  : Config|null
$dbServiceManager  : PluginManager
Database service plugin manager
$emailAuthenticator  : EmailAuthenticator|null
$encryptionEnabled  : bool
Is encryption enabled?
$encryptionKey  : string
Encryption key used for catalog passwords (null if encryption disabled):
$ilsAccount  : array<string|int, mixed>
Cache for ILS account information (keyed by username)
__construct()  : mixed
Constructor
decrypt()  : Array|bool
Decrypt text.
encrypt()  : Array|bool
Encrypt text.
getCatPasswordForUser()  : string|null
Given a user object, retrieve the decrypted password (or null if unset/invalid).
getDbService()  : T
Get a database service object.
getDbServiceManager()  : PluginManager
Get the service plugin manager. Throw an exception if it is missing.
getStoredCatalogCredentials()  : array<string|int, mixed>|bool
Get stored catalog credentials for the current user.
newCatalogLogin()  : array<string|int, mixed>|bool
Attempt to log in the user to the ILS, and save credentials if it works.
passwordEncryptionEnabled()  : bool
Is ILS password encryption enabled?
processEmailLoginHash()  : array<string|int, mixed>|bool
Process email login
saveUserCatalogCredentials()  : void
Save ILS login credentials.
sendEmailLoginLink()  : void
Send email authentication link
setDbServiceManager()  : void
Set the service plugin manager.
setUserCatalogCredentials()  : void
Set ILS login credentials for a user without saving them.
storedCatalogLogin()  : array<string|int, mixed>|bool
Log the current user into the catalog using stored credentials; if this fails, clear the user's stored credentials so they can enter new, corrected ones.
updateUserHomeLibrary()  : void
Change and persist the user's home library.
encryptOrDecrypt()  : Array|bool
This is a central function for encrypting and decrypting so that logic is all in one location
getAuthManager()  : Manager
Get authentication manager
updateUser()  : void
Update current user account with the patron information

Properties

$authManagerCallback

Callback for retrieving the authentication manager

protected callable $authManagerCallback

$encryptionEnabled

Is encryption enabled?

protected bool $encryptionEnabled = null

$encryptionKey

Encryption key used for catalog passwords (null if encryption disabled):

protected string $encryptionKey = null

$ilsAccount

Cache for ILS account information (keyed by username)

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

Methods

__construct()

Constructor

public __construct(callable $authCB, Connection $catalog[, EmailAuthenticator|null $emailAuthenticator = null ][, Config|null $config = null ]) : mixed
Parameters
$authCB : callable

Auth manager callback

$catalog : Connection

ILS connection

$emailAuthenticator : EmailAuthenticator|null = null

Email authenticator

$config : Config|null = null

Configuration from config.ini

Return values
mixed

decrypt()

Decrypt text.

public decrypt(string|null $text) : Array|bool
Parameters
$text : string|null

The text to decrypt (null values will be returned as null)

Tags
throws
PasswordSecurity
Return values
Array|bool

The decrypted string (null if empty or false if invalid)

encrypt()

Encrypt text.

public encrypt(string|null $text) : Array|bool
Parameters
$text : string|null

The text to encrypt (null values will be returned as null)

Tags
throws
PasswordSecurity
Return values
Array|bool

The encrypted string (null if empty or false if invalid)

getDbService()

Get a database service object.

public getDbService(class-string<\VuFind\Db\Service\T> $name) : T
Parameters
$name : class-string<\VuFind\Db\Service\T>

Name of service to retrieve

Tags
template

T

Return values
T

getStoredCatalogCredentials()

Get stored catalog credentials for the current user.

public getStoredCatalogCredentials() : array<string|int, mixed>|bool

Returns associative array of cat_username and cat_password if they are available, false otherwise. This method does not verify that the credentials are valid.

Return values
array<string|int, mixed>|bool

newCatalogLogin()

Attempt to log in the user to the ILS, and save credentials if it works.

public newCatalogLogin(string $username, string $password) : array<string|int, mixed>|bool
Parameters
$username : string

Catalog username

$password : string

Catalog password

Returns associative array of patron data on success, false on failure.

Tags
throws
ILS
Return values
array<string|int, mixed>|bool

passwordEncryptionEnabled()

Is ILS password encryption enabled?

public passwordEncryptionEnabled() : bool
Return values
bool

processEmailLoginHash()

Process email login

public processEmailLoginHash(string $hash) : array<string|int, mixed>|bool
Parameters
$hash : string

Login hash

Tags
throws
ILS
Return values
array<string|int, mixed>|bool

saveUserCatalogCredentials()

Save ILS login credentials.

public saveUserCatalogCredentials(UserEntityInterface $user, string $username, string|null $password) : void
Parameters
$user : UserEntityInterface

User to update

$username : string

Username to save

$password : string|null

Password to save

Tags
throws
PasswordSecurity
Return values
void

Send email authentication link

public sendEmailLoginLink(string $email, string $route[, array<string|int, mixed> $routeParams = [] ][, array<string|int, mixed> $urlParams = [] ]) : void
Parameters
$email : string

Email address

$route : string

Route for the login link

$routeParams : array<string|int, mixed> = []

Route parameters

$urlParams : array<string|int, mixed> = []

URL parameters

Return values
void

setUserCatalogCredentials()

Set ILS login credentials for a user without saving them.

public setUserCatalogCredentials(UserEntityInterface $user, string $username, string|null $password) : void
Parameters
$user : UserEntityInterface

User to update

$username : string

Username to save

$password : string|null

Password to save (null for none)

Return values
void

storedCatalogLogin()

Log the current user into the catalog using stored credentials; if this fails, clear the user's stored credentials so they can enter new, corrected ones.

public storedCatalogLogin() : array<string|int, mixed>|bool

Returns associative array of patron data on success, false on failure.

Return values
array<string|int, mixed>|bool

updateUserHomeLibrary()

Change and persist the user's home library.

public updateUserHomeLibrary(UserEntityInterface $user, string|null $homeLibrary) : void
Parameters
$user : UserEntityInterface

User to update

$homeLibrary : string|null

New home library value (or null to clear)

Return values
void

encryptOrDecrypt()

This is a central function for encrypting and decrypting so that logic is all in one location

protected encryptOrDecrypt(string|null $text[, bool $encrypt = true ]) : Array|bool
Parameters
$text : string|null

The text to be encrypted or decrypted

$encrypt : bool = true

True if we wish to encrypt text, False if we wish to decrypt text.

Tags
throws
PasswordSecurity
Return values
Array|bool

The encrypted/decrypted string (null = empty input; false = error)

updateUser()

Update current user account with the patron information

protected updateUser(string $catUsername, string $catPassword, array<string|int, mixed> $patron) : void
Parameters
$catUsername : string

Catalog username

$catPassword : string

Catalog password

$patron : array<string|int, mixed>

Patron

Return values
void

Search results