Page MenuHomePhorge
Diviner Tech Docs PhutilAuthAdapter

abstract class PhutilAuthAdapter
Phorge Technical Documentation (Auth)

Abstract interface to an identity provider or authentication source, like Twitter, Facebook, or Google.

Generally, adapters are handed some set of credentials particular to the provider they adapt, and they turn those credentials into standard information about the user's identity. For example, the LDAP adapter is given a username and password (and some other configuration information), uses them to talk to the LDAP server, and produces a username, email, and so forth.

Since the credentials a provider requires are specific to each provider, the base adapter does not specify how an adapter should be constructed or configured -- only what information it is expected to be able to provide once properly configured.

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

final public function getAccountIdentifiers()

This method is not documented.
Return
wild

protected function newAccountIdentifiers()

This method is not documented.
Return
wild

final protected function newAccountIdentifier($raw_identifier)

This method is not documented.
Parameters
$raw_identifier
Return
wild

public function getAccountID()

Get a unique identifier associated with the account.

This identifier should be permanent, immutable, and uniquely identify the account. If possible, it should be nonsensitive. For providers that have a GUID or PHID value for accounts, these are the best values to use.

You can implement newAccountIdentifiers() instead if a provider is unable to emit identifiers with all of these properties.

If the adapter was unable to authenticate an identity, it should return null.

Return
string|nullUnique account identifier, or `null` if authentication failed.

abstract public function getAdapterType()

Get a string identifying this adapter, like "ldap". This string should be unique to the adapter class.

Return
stringUnique adapter identifier.

abstract public function getAdapterDomain()

Get a string identifying the domain this adapter is acting on. This allows an adapter (like LDAP) to act against different identity domains without conflating credentials. For providers like Facebook or Google, the adapters just return the relevant domain name.

Return
stringDomain the adapter is associated with.

public function getAdapterKey()

Generate a string uniquely identifying this adapter configuration. Within the scope of a given key, all account IDs must uniquely identify exactly one identity.

Return
stringUnique identifier for this adapter configuration.

public function getAccountEmail()

Optionally, return an email address associated with this account.

Return
string|nullAn email address associated with the account, or `null` if data is not available.

public function getAccountName()

Optionally, return a human readable username associated with this account.

Return
string|nullAccount username, or `null` if data isn't available.

public function getAccountURI()

Optionally, return a URI corresponding to a human-viewable profile for this account.

Return
string|nullA profile URI associated with this account, or `null` if the data isn't available.

public function getAccountImageURI()

Optionally, return a profile image URI associated with this account.

Return
string|nullURI for an account profile image, or `null` if one is not available.

public function getAccountRealName()

Optionally, return a real name associated with this account.

Return
string|nullA human real name, or `null` if this data is not available.