auth:cosign
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
auth:cosign [2009-06-05 16:32] – created 128.118.235.116 | auth:cosign [2010-09-24 22:53] – 141.211.209.33 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CoSign Authentication Backend ====== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | Since [[http:// | ||
+ | |||
+ | |||
+ | ===== Requirements ===== | ||
+ | |||
+ | * a [[http:// | ||
+ | * configuration parameters for your web server (apache) | ||
+ | |||
+ | |||
+ | |||
+ | ===== Code ===== | ||
+ | |||
+ | Save this under .../ | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | /** | ||
+ | * Cosign authentication backend | ||
+ | * | ||
+ | * @license | ||
+ | * @author | ||
+ | * Version: 1.0 | ||
+ | * last modified: 2009-06-18 15:54 | ||
+ | * | ||
+ | * Work based on the plaintext authentication backend: | ||
+ | * @author | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | define(' | ||
+ | require_once(DOKU_AUTH.'/ | ||
+ | |||
+ | define(' | ||
+ | |||
+ | // we only accept page ids for auth_plain | ||
+ | if(isset($_REQUEST[' | ||
+ | $_REQUEST[' | ||
+ | if(isset($_REQUEST[' | ||
+ | $_REQUEST[' | ||
+ | // the same goes for password reset requests | ||
+ | if(isset($_POST[' | ||
+ | $_POST[' | ||
+ | } | ||
+ | |||
+ | class auth_cosign extends auth_plain { | ||
+ | |||
+ | /** | ||
+ | * Constructor | ||
+ | * | ||
+ | * Carry out sanity checks to ensure the object is | ||
+ | * able to operate. Set capabilities. | ||
+ | * | ||
+ | * @author | ||
+ | */ | ||
+ | function auth_cosign() { | ||
+ | // call the parent constructor | ||
+ | parent:: | ||
+ | |||
+ | // indicate we should be trusting an external auth checker | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | /** | ||
+ | * Trust External AuthN | ||
+ | * | ||
+ | * @author | ||
+ | * @return | ||
+ | */ | ||
+ | function trustExternal($user, | ||
+ | global $USERINFO; | ||
+ | |||
+ | $result = false; | ||
+ | |||
+ | if (!empty($user)) { | ||
+ | // verify the user is logged in through WebAccess | ||
+ | if (isset($_SERVER[' | ||
+ | $userinfo = $this-> | ||
+ | if ($userinfo !== false) { | ||
+ | $result = true; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | } else { | ||
+ | // regular session auth check | ||
+ | if (isset($_SERVER[' | ||
+ | $userinfo = $this-> | ||
+ | if ($userinfo !== false) { | ||
+ | $result = true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // set the necessary global variables | ||
+ | if ($result) { | ||
+ | $USERINFO = $userinfo; | ||
+ | |||
+ | // set session | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | } | ||
+ | |||
+ | return $result; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | //Setup VIM: ex: et ts=2 enc=utf-8 : | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Configuration ===== | ||
+ | |||
+ | Configure apache to use [[http:// | ||
+ | |||
+ | Authorized users can be managed via the user-manager plugin now. The passwords in users.auth.php is ignored. Just put a dummy value in there. | ||
+ | |||
+ | You may want to remove the Login and Logout buttons from the template as well since they have no use. Logout is accomplished by closing the browser window or by the timeout specified by the [[http:// | ||
+ | |||
+ | |||
+ | ===== Discussion ===== | ||
+ | > 2009/06/05: Currently experiencing a problem that the authentication does not work when saving changes. Am working on a fix. | ||
+ | >> 2009/06/18: Reworked the authentication class and resolved the problem of being logged out when saving changes. | ||
+ | |||
+ | |||
+ | This is awesome. Thank you. | ||