Skip to content

Instantly share code, notes, and snippets.

@simonmilz
Created April 28, 2015 08:51
Show Gist options
  • Save simonmilz/90e0d5851e3f276fd697 to your computer and use it in GitHub Desktop.
Save simonmilz/90e0d5851e3f276fd697 to your computer and use it in GitHub Desktop.
tt
<?php
class User {
protected $email;
protected $password;
public function is($role = 'user') {}
public function login($email, $pass) {}
public function isLoggedin() {}
getEmail
getPass
}
class Auth {
protected $_provider = array();
public function addAuthProvider(AuthProvider $provider) {}
public function authenticate(User $user) {}
}
interface AuthProvider {
public function authenticate(User $user);
}
class AuthProviderLdap implements AuthProvider {}
class AuthProviderDb implements AuthProvider {}
class AuthProviderOauth implements AuthProvider {}
// ************************** //
$user = new User($email, $password);
$auth = new Auth();
$auth
->addAuthProvider($db)
->addAuthProvider($ldap)
->addAuthProvider($oauth)
;
$AuthController->authenticate($user);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment