Documentation

Basic extends AbstractAuth
in package

HTTP Basic authentication utility.

This class helps you setup basic auth. The process is fairly simple:

  1. Instantiate the class.
  2. Call getCredentials (this will return null or a user/pass pair)
  3. If you didn't get valid credentials, call 'requireLogin'
Tags
copyright

Copyright (C) fruux GmbH (https://fruux.com/)

author

Evert Pot (http://evertpot.com/)

license

http://sabre.io/license/ Modified BSD License

Table of Contents

$realm  : string
Authentication realm.
$request  : RequestInterface
Request object.
$response  : ResponseInterface
Response object.
__construct()  : mixed
Creates the object.
getCredentials()  : array<string|int, mixed>|null
This method returns a numeric array with a username and password as the only elements.
getRealm()  : string
Returns the HTTP realm.
requireLogin()  : mixed
This method sends the needed HTTP header and statuscode (401) to force the user to login.

Properties

Methods

getCredentials()

This method returns a numeric array with a username and password as the only elements.

public getCredentials() : array<string|int, mixed>|null

If no credentials were found, this method returns null.

Return values
array<string|int, mixed>|null

getRealm()

Returns the HTTP realm.

public getRealm() : string
Return values
string

requireLogin()

This method sends the needed HTTP header and statuscode (401) to force the user to login.

public requireLogin() : mixed
Return values
mixed

Search results