JDBCAuth

Factory interface for creating @see \io\vertx\jphp\ext\auth\AuthProvider instances that use the Vert.x JDBC client.

By default the hashing strategy is SHA-512. If you're already running in production this is backwards compatible, however for new deployments or security upgrades it is recommended to use the PBKDF2 strategy as it is the current OWASP recommendation for password storage.

package

Default

Methods

__construct

__construct() 

Authenticate a user.

authenticate( $arg0,  $arg1) : void

The first argument is a JSON object containing information for authenticating the user. What this actually contains depends on the specific implementation. In the case of a simple username/password based authentication it is likely to contain a JSON object with the following structure:

  {
    "username": "tim",
    "password": "mypassword"
  }
For other types of authentication it contain different information - for example a JWT token or OAuth bearer token.

If the user is successfully authenticated a object is passed to the handler in an \io.vertx.core.AsyncResult. The user object can then be used for authorisation.

Arguments

$arg0

array

$arg1

callable

Compute the hashed password given the unhashed password and the salt without nonce

computeHash( $arg0,  $arg1,  $arg2 = null) : string

The implementation relays to the JDBCHashStrategy provided.

param $password [string] the unhashed password param $salt [string] the salt computeHash($password, $salt)

Compute the hashed password given the unhashed password and the salt

The implementation relays to the JDBCHashStrategy provided.

param $password [string] the unhashed password param $salt [string] the salt param $version [integer] the nonce version to use computeHash($password, $salt, $version)

Arguments

$arg0

string

$arg1

string

$arg2

integer

Response

string

the hashed password

Create a JDBC auth provider implementation

create( $arg0,  $arg1) : \io\vertx\jphp\ext\auth\jdbc\JDBCAuth
static

Arguments

$arg0

Vertx

$arg1

JDBCClient

Response

\io\vertx\jphp\ext\auth\jdbc\JDBCAuth

the auth provider

Compute a salt string.

generateSalt() : string

The implementation relays to the JDBCHashStrategy provided.

Response

string

a non null salt value

Set the authentication query to use. Use this if you want to override the default authentication query.

setAuthenticationQuery( $arg0) : $this

Arguments

$arg0

string

Response

$this

a reference to this for fluency

Provide a application configuration level on hash nonce's as a ordered list of nonces where each position corresponds to a version.

setNonces( $arg0) : $this

The nonces are supposed not to be stored in the underlying jdbc storage but to be provided as a application configuration. The idea is to add one extra variable to the hash function in order to make breaking the passwords using rainbow tables or precomputed hashes harder. Leaving the attacker only with the brute force approach.

The implementation relays to the JDBCHashStrategy provided.

Arguments

$arg0

array

Response

$this

a reference to this for fluency

Set the permissions query to use. Use this if you want to override the default permissions query.

setPermissionsQuery( $arg0) : $this

Arguments

$arg0

string

Response

$this

a reference to this for fluency

Set the role prefix to distinguish from permissions when checking for isPermitted requests.

setRolePrefix( $arg0) : $this

Arguments

$arg0

string

Response

$this

a reference to this for fluency

Set the roles query to use. Use this if you want to override the default roles query.

setRolesQuery( $arg0) : $this

Arguments

$arg0

string

Response

$this

a reference to this for fluency

Constants

The default query to be used for authentication

DEFAULT_AUTHENTICATE_QUERY
var

php文件只是为了写代码方便,常量的实际值请参考原java文件

The default query to retrieve all roles for the user

DEFAULT_ROLES_QUERY
var

php文件只是为了写代码方便,常量的实际值请参考原java文件

The default query to retrieve all permissions for the role

DEFAULT_PERMISSIONS_QUERY
var

php文件只是为了写代码方便,常量的实际值请参考原java文件

The default role prefix

DEFAULT_ROLE_PREFIX
var

php文件只是为了写代码方便,常量的实际值请参考原java文件