PublicKeyCredentialSourceRepositoryMySql
extends PublicKeyCredentialSourceRepositoryBase
in package
Credential repository that uses a given PDO for data access.
Table of Contents
- $pdo : PDO
- __construct() : mixed
- Constructor
- checkSchema() : void
- Checks if the schema needs to be updated.
- createInitialSchema() : mixed
- Creates the initial schema.
- deleteDevice() : bool
- Deletes a single device from the database.
- export() : array<string|int, mixed>
- Exports all entries.
- findAllForUserEntity() : array<string|int, PublicKeyCredentialSource>
- Finds all credential entries for the given user.
- findOneByCredentialId() : PublicKeyCredentialSource|null
- Finds the public key for the given credential id.
- hasRegisteredCredentials() : bool
- Returns if there are any credentials in the database.
- import() : mixed
- Imports entries from export data.
- saveCredentialSource() : void
- Saves the given credential in the database.
- searchDevices() : array<string|int, mixed>
- Performs a full-text search on the user names and returns all devices found.
- updateDeviceName() : bool
- Updates the device name.
- addNameColumn() : mixed
- Adds the name column if not existing.
- getPDO() : PDO
- Returns the PDO.
- getTableName() : string
- Returns the table name to use.
Properties
$pdo
private
PDO
$pdo
Methods
__construct()
Constructor
public
__construct(PDO $pdo) : mixed
Parameters
- $pdo : PDO
-
PDO
Return values
mixed —checkSchema()
Checks if the schema needs to be updated.
public
checkSchema() : void
Return values
void —createInitialSchema()
Creates the initial schema.
public
createInitialSchema(PDO $pdo) : mixed
Parameters
- $pdo : PDO
-
PDO object
Return values
mixed —deleteDevice()
Deletes a single device from the database.
public
deleteDevice(string $dn, string $credentialId) : bool
Parameters
- $dn : string
-
user DN
- $credentialId : string
-
credential id
Return values
bool —deletion was ok
export()
Exports all entries.
public
export() : array<string|int, mixed>
Return values
array<string|int, mixed> —data
findAllForUserEntity()
Finds all credential entries for the given user.
public
findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCredentialUserEntity) : array<string|int, PublicKeyCredentialSource>
Parameters
- $publicKeyCredentialUserEntity : PublicKeyCredentialUserEntity
-
credential user entity
Return values
array<string|int, PublicKeyCredentialSource> —credential sources
findOneByCredentialId()
Finds the public key for the given credential id.
public
findOneByCredentialId(string $publicKeyCredentialId) : PublicKeyCredentialSource|null
Parameters
- $publicKeyCredentialId : string
-
credential id
Return values
PublicKeyCredentialSource|null —credential source
hasRegisteredCredentials()
Returns if there are any credentials in the database.
public
hasRegisteredCredentials() : bool
Return values
bool —at least one credential in the database
import()
Imports entries from export data.
public
import(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
export data
Return values
mixed —saveCredentialSource()
Saves the given credential in the database.
public
saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource) : void
Parameters
- $publicKeyCredentialSource : PublicKeyCredentialSource
-
credential
Return values
void —searchDevices()
Performs a full-text search on the user names and returns all devices found.
public
searchDevices(string $searchTerm) : array<string|int, mixed>
Parameters
- $searchTerm : string
-
search term for user field
Return values
array<string|int, mixed> —list of devices array('dn' => ..., 'credentialId' => ..., 'lastUseTime' => ..., 'registrationTime' => ...)
updateDeviceName()
Updates the device name.
public
updateDeviceName(string $dn, string $credentialId, string $name) : bool
Parameters
- $dn : string
-
user DN
- $credentialId : string
-
credential id
- $name : string
-
new name
Return values
bool —success
addNameColumn()
Adds the name column if not existing.
protected
addNameColumn(PDO $pdo) : mixed
Parameters
- $pdo : PDO
-
PDO
Return values
mixed —getPDO()
Returns the PDO.
protected
getPDO() : PDO
Tags
Return values
PDO —PDO
getTableName()
Returns the table name to use.
protected
getTableName() : string
Tags
Return values
string —table name