Overview

Namespaces

  • BSN
    • CryptUser

Classes

  • CryptJSONSource
  • CryptMySQLSource
  • CryptUser
  • SSLKey

Interfaces

  • CryptDataSource
  • Overview
  • Namespace
  • Class
  • Tree

Class CryptUser

CryptUser object.

Namespace: BSN\CryptUser
Copyright: Copyright 2013, Bryan Nielsen
Author: Bryan Nielsen, bnielsen1965@gmail.com
Located at Class/CryptUser.php
Methods summary
public
# __construct( string $username, string $password, string $dataSource = NULL )

Object constructor

Object constructor

Parameters

$username
string
username The username for this user.
$password
string
$password The password for this user.
$dataSource
string
$dataSource An object to provide the user data.
private boolean
# loadUser( )

Load this user defined by this object from the data source

Load this user defined by this object from the data source

Returns

boolean
TRUE on success, FALSE on failure
public boolean
# saveUser( )

Save this user to the data source

Save this user to the data source

Returns

boolean
TRUE on success, FALSE on failure.
public boolean
# newUser( )

Complete the steps to establish this as a new user in the data source.

Complete the steps to establish this as a new user in the data source.

Returns

boolean
TRUE on success, FALSE on failure
public string
# getUsername( )

Get the username string for this user.

Get the username string for this user.

Returns

string
The username value.
public boolean
# setPrimaryKey( string $key = NULL, string $certificate = NULL )

Set the primary SSLKey to use with this user.

Set the primary SSLKey to use with this user.

Parameters

$key
string
$key Optional PEM encoded private key to use in generating the SSLKey.
$certificate
string
$certificate Optional PEM encoded certificate to use in generating the SSLKey.

Returns

boolean
TRUE on success, FALSE on failure.
public boolean
# setACLFlags( integer $flagMask )

Sets the Access Control Level flags specified in the flagMask variable.

Sets the Access Control Level flags specified in the flagMask variable.

Parameters

$flagMask
integer
$flagMask Integer containing the binary flags to turn on.

Returns

boolean
TRUE on success, FALSE on failure.
public boolean
# clearACLFlags( integer $flagMask )

Clears the Access Control Level flags specified in flagMask.

Clears the Access Control Level flags specified in flagMask.

Parameters

$flagMask
integer
$flagMask Integer containing the binary flags to turn off.

Returns

boolean
TRUE on success, FALSE on failure.
public
# setAllACLFlags( )

Set all possible ACL flags on this user.

Set all possible ACL flags on this user.

public
# clearAllACLFlags( )

Clear all possible ACL flags on this user.

Clear all possible ACL flags on this user.

public boolean
# isACLFlagSet( integer $flagMask )

Test if the specified flags are set as specified in the flagMask argument.

Test if the specified flags are set as specified in the flagMask argument.

Parameters

$flagMask
integer
$flagmask Integer containing the binary flags to test.

Returns

boolean
TRUE if the specified flags are set, FALSE if any of the flags are not set.
public boolean
# isAdmin( )

Determine if this user is an admin

Determine if this user is an admin

Returns

boolean
TRUE if admin, FALSE if not.
public boolean
# isActive( )

Determine if this user account is active.

Determine if this user account is active.

Returns

boolean
TRUE if active, FALSE if not.
public boolean
# isAuthenticated( )

Check if this user is authenticated.

Check if this user is authenticated.

Returns

boolean
TRUE if authenticated, FALSE if not.
public boolean
# changePassword( string $password, string $callback = NULL )

Change the user's password and the SSL Key elements that rely on the password.

Change the user's password and the SSL Key elements that rely on the password.

Parameters

$password
string
$password The new password to use.
$callback
string
$callback Optional callback function used by the application for post password change maintenance like re-encryption of data. The callback must accept two CryptUser objects, the first object is the CryptUser with the new password and encryption key, the second object is the Cryptuser with the old password and encryption key.

Returns

boolean
TRUE on success, FALSE on failure.
public array
# encryptPackage( mixed $package )

Encrypt a package using the primary SSL key pair.

Encrypt a package using the primary SSL key pair.

Parameters

$package
mixed
$package The package to encrypt.

Returns

array
An array containing the envelope and encrypted package or NULL if an error occurs.
public mixed
# decryptPackage( mixed $package )

Decrypt the sealed package using the primary SSL key pair.

Decrypt the sealed package using the primary SSL key pair.

Parameters

$package
mixed
$package An associative array containing 'package' and 'envelope'.

Returns

mixed
The decrypted package or FALSE if there was an error.
public object
# getDatasource( )

Get the data source used for this user.

Get the data source used for this user.

Returns

object
The data source object for this user.
public static string
# hashPassword( string $password, string $salt = NULL )

Hash the provided password string.

Hash the provided password string.

Parameters

$password
string
$password The plain text user password.
$salt
string
$salt Optional salt to use with crypt. The salt must be provided when performing a password hash check to make sure the hash values come out the same. If no salt is provided then the best salt for this server will be generated.

Returns

string
The hashed password.
public static string
# bestSalt( )

Determine the best salt to use for the crypt function on this server.

Determine the best salt to use for the crypt function on this server.

Returns

string
The salt to be used with crypt.
Constants summary
integer ACL_ADMIN_FLAG 1
#

Class constants

Class constants

integer ACL_ACTIVE_FLAG 2
#
integer ACL_ALL_FLAGS 3
#
Properties summary
private mixed $username
#

Class properties

Class properties

private mixed $password
#
private mixed $passwordHash
#
private mixed $authenticated
#
private mixed $primaryKey
#
private mixed $sslKey
#
private mixed $flags
#
private mixed $dataSource
#
cryptUser API documentation generated by ApiGen 2.8.0