AuthTrait
Table of Contents
Properties
- $provider : AdapterInterface|null
Methods
- handleAuthenticate() : void
- handleLogin() : void
- processOauthCallback() : void
- executeLogin() : void
- flashLoginFailure() : void
- Reports a failed external sign-in the same way as the password sign-in ({@see \App\Core\Traits\Front\Presenters\AuthStorageTrait::processFailedLogin()}).
- getCallbackUrl() : string
- loadProvider() : AdapterInterface
- Loads the provider OAuth configuration.
- log() : void
Properties
$provider
private
AdapterInterface|null
$provider
= null
Methods
handleAuthenticate()
public
handleAuthenticate(string $providerName) : void
Parameters
- $providerName : string
handleLogin()
public
handleLogin([string|null $providerName = null ]) : void
Parameters
- $providerName : string|null = null
processOauthCallback()
public
processOauthCallback(string $providerName) : void
Parameters
- $providerName : string
executeLogin()
private
executeLogin(string $providerName) : void
Parameters
- $providerName : string
flashLoginFailure()
Reports a failed external sign-in the same way as the password sign-in ({@see \App\Core\Traits\Front\Presenters\AuthStorageTrait::processFailedLogin()}).
private
flashLoginFailure(Presenter $presenter, ResultCode $code) : void
The flash receives the finished translation (not a key): the shared flash layout partial
translates with its own domain, so a key would stay untranslated. The redirect is needed
because the callback URL /oauth/callback/<provider> has an empty template, so a flash
message would have nowhere to show.
Parameters
- $presenter : Presenter
- $code : ResultCode
getCallbackUrl()
private
getCallbackUrl(string $providerName) : string
Parameters
- $providerName : string
Return values
stringloadProvider()
Loads the provider OAuth configuration.
private
loadProvider(string $providerName) : AdapterInterface
IMPORTANT: the client id and secret must not be read from the loaded entity: both fields
have #[FieldAccess(read: Audience::Privileged)] and the front end runs as guest, so
the entity would give empty strings and Hybridauth would try to authenticate with empty
keys. The keys therefore come from the dedicated internal action
:Api:System:LoginProvider:oauthConfig, which builds its payload by hand outside the
hydrator and has no action*(), so external HTTP cannot reach it. See
LoginProviderPresenter::internalActionOauthConfig().
Parameters
- $providerName : string
Return values
AdapterInterfacelog()
private
log(string $message[, array<string, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string, mixed> = []