Authentication results¶
ResultInterface¶
Every call to the
authenticate()
method of the authentication service will return a result object. The returned
result is defined by the
ResultInterface
:
-
interface
BaconAuthentication\Result\
ResultInterface
¶ Generic result interface.
-
BaconAuthentication\Result\ResultInterface::
isSuccess
()¶ Returns whether the authentication was successful.
Returns: bool
-
BaconAuthentication\Result\ResultInterface::
isFailure
()¶ Returns whether the authentication was a failure.
Returns: bool
-
BaconAuthentication\Result\ResultInterface::
isChallenge
()¶ Returns whether the authentication generated a challenge.
Returns: bool
-
BaconAuthentication\Result\ResultInterface::
getPayload
()¶ Returns the payload associated with the result.
For a successful result, the payload should be the identity of the subject. In the case of a failure, it should contain error information enclosed in an
Error
object. For a challenge, no payload is required.Returns: mixed|null
Result¶
BaconAuthentication provides a generic implementation of the
ResultInterface
,
which should be sufficient for most use-cases. It defines the following
additional methods:
-
class
BaconAuthentication\Result\
Result
¶ Generic result implementation.
-
constant
BaconAuthentication\Result\Result::
STATE_SUCCESS
¶ success
-
constant
BaconAuthentication\Result\Result::
STATE_FAILURE
¶ failure
-
constant
BaconAuthentication\Result\Result::
STATE_CHALLENGE
¶ challenge
-
BaconAuthentication\Result\Result::
__construct
($state[, $payload])¶ Parameters: - $state (string) –
- $payload (mixed|null) –
Error¶
The Error
object which is
returned as payload in the case of a failure is defined like this:
-
class
BaconAuthentication\Result\
Error
¶
-
BaconAuthentication\Result\Error::
__construct
($scope, $message)¶ Parameters: - $scope (string) –
- $message (string) –
-
BaconAuthentication\Result\Error::
getScope
()¶ Returns: string
-
BaconAuthentication\Result\Error::
getMessage
()¶ Returns: string