class BasicAuthAuthenticator implements AuthenticatorInterface (View source)

An authenticator using SilverStripe's BasicAuth

Methods

public
Member|null
authenticate(HTTPRequest $request)

Given the current request, authenticate the request for non-session authorization (outside the CMS).

public
bool
isApplicable(HTTPRequest $request)

Determine if this authenticator is applicable to the current request

protected
bool
hasAuthHandler(string $servervar)

Check for $_SERVERVAR with basic auth credentials

Details

Member|null authenticate(HTTPRequest $request)

Given the current request, authenticate the request for non-session authorization (outside the CMS).

The Member returned from this method will be provided to the Manager for use in the OperationResolver context in place of the current CMS member.

Authenticators can be given a priority. In this case, the authenticator with the highest priority will be returned first. If not provided, it will default to a low number.

An example for configuring the BasicAuthAuthenticator:

SilverStripe\GraphQL:
  authenticators:
    - class: SilverStripe\GraphQL\Auth\BasicAuthAuthenticator
      priority: 10

Parameters

HTTPRequest $request

The current HTTP request

Return Value

Member|null

If authentication is successful

Exceptions

ValidationException

bool isApplicable(HTTPRequest $request)

Determine if this authenticator is applicable to the current request

Parameters

HTTPRequest $request

Return Value

bool

protected bool hasAuthHandler(string $servervar)

Check for $_SERVERVAR with basic auth credentials

Parameters

string $servervar

Return Value

bool