コード例 #1
0
ファイル: AuthAlfresco.php プロジェクト: negabaro/alfresco
 function authenticate($username, $password)
 {
     global $alfTicket, $alfRepository, $alfWikiSpaceNodeRef, $alfLog;
     $result = false;
     $localTicket = MediaWikiSpace::validate($alfRepository, $alfWikiSpaceNodeRef, $username, $password);
     if ($localTicket != null) {
         // Store the ticket for later use now we know it's good
         $alfTicket = $localTicket;
         $_SESSION["alfTicket"] = $localTicket;
         $result = true;
     }
     return $result;
 }
コード例 #2
0
ファイル: Alfresco.php プロジェクト: negabaro/alfresco
    if (sizeof($nodes) == 0) {
        // Redirect to the login page, since we can't find the mediaWiki space (probably means incorrect permissions)
        header("Location: " . $loginURL);
        exit;
    }
    $alfMediaWikiNode = $nodes[0];
    $alfWikiSpaceNodeRef = $alfMediaWikiNode->__toString();
}
// Validate the ticket (checks you have correct permissions on the wiki space and that the ticket is valid)
if (MediaWikiSpace::validate($alfRepository, $alfWikiSpaceNodeRef, "", $alfTicket) == false) {
    // Redirect to the login page, since the ticket is knacked or you don't have permissions
    header("Location: " . $loginURL);
    exit;
}
// Set the configuration values
eval(MediaWikiSpace::getEvaluationString($alfRepository, $alfWikiSpaceNodeRef));
// Make sure the setup is not included later
define(MW_NO_SETUP, true);
require_once "Setup.php";
// Check to see if we should be doing an 'auto' login
if ($doLogin == true) {
    // Authenticate the mediawiki user
    $u = User::newFromName($passedUser);
    if (is_null($u) == false && User::isUsableName($u->getName()) == true) {
        // Check to see if the user already exists
        if (0 == $u->getID()) {
            if ($wgAuth->autoCreate() == true && $wgAuth->userExists($u->getName()) == true) {
                if ($wgAuth->authenticate($u->getName(), $passedTicket) == true) {
                    // Initialise the user
                    $u->addToDatabase();
                    $wgAuth->initUser($u);