Skip to content

Instantly share code, notes, and snippets.

@ikkez
Created April 9, 2015 12:45
Show Gist options
  • Save ikkez/7e927c7a795e71daa673 to your computer and use it in GitHub Desktop.
Save ikkez/7e927c7a795e71daa673 to your computer and use it in GitHub Desktop.
F3 Single User Basic Auth Wrap
<?php
/**
* Simple Single User Basic Auth
*
* Usage:
* $auth = new \BasicAuth('admin','e9bGrU8n');
* if ($auth->basic()) { ... }
*
**/
class BasicAuth extends Auth {
function __construct($user,$pass) {
parent::__construct('basic', array('id'=>$user, 'pw'=>$pass));
}
protected function _basic ($id,$pw,$realm) {
return (bool) ($this->args['id'] == $id && $this->args['pw'] == $pw);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment