Exemplo n.º 1
0
 public function register()
 {
     $this->app->bind('oauth/factory/service', function ($app, $params = array()) {
         $factory = new ServiceFactory();
         $factory->setHttpClient($client = new CurlClient());
         $client->setCurlParameters((array) $params);
         return $factory;
     });
     $this->app->bindShared('oauth/factory/extractor', function () {
         return new ExtractorFactory();
     });
     $this->app->bind('oauth_extractor', function ($app, $params = array()) {
         if (!is_array($params)) {
             $params = array($params);
         }
         if (!($service = head($params))) {
             throw new \InvalidArgumentException('No Service given.');
         }
         $extractor_factory = $app->make('oauth/factory/extractor');
         return $extractor_factory->get($service);
     });
     \Route::register('/ccm/system/authentication/oauth2/{type}/{action}', function ($type, $action) {
         try {
             $type = \AuthenticationType::getByHandle($type);
             if ($type && is_object($type) && !$type->isError()) {
                 /** @var GenericOauthTypeController $controller */
                 $controller = $type->getController();
                 if ($controller instanceof GenericOauthTypeController) {
                     switch ($action) {
                         case 'attempt_auth':
                             return $controller->handle_authentication_attempt();
                             break;
                         case 'callback':
                             return $controller->handle_authentication_callback();
                             break;
                         case 'attempt_attach':
                             return $controller->handle_attach_attempt();
                             break;
                         case 'attach_callback':
                             return $controller->handle_attach_callback();
                             break;
                     }
                 }
             }
         } catch (\Exception $e) {
             \Log::addNotice('OAUTH ERROR: ' . $e->getMessage());
         }
     });
 }
Exemplo n.º 2
0
}
?>
	<?php 
if (is_array($attribs) && count($attribs)) {
    $af = Loader::helper('form/attribute');
    $af->setAttributeObject($profile);
    foreach ($attribs as $ak) {
        print '<div class="ccm-profile-attribute">';
        print $af->display($ak, $ak->isAttributeKeyRequiredOnProfile());
        print '</div>';
    }
}
?>
	</fieldset>
	<?php 
$ats = AuthenticationType::getList(true, true);
$ats = array_filter($ats, function (AuthenticationType $type) {
    return $type->hasHook();
});
$count = count($ats);
if ($count) {
    ?>
		<fieldset>
			<legend><?php 
    echo t('Authentication Types');
    ?>
</legend>
			<?php 
    foreach ($ats as $at) {
        $at->renderHook();
    }
Exemplo n.º 3
0
<?php

$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
//get all authentication types for output in drop down
$authenticationTypeArray = array();
$authenticationTypeObj = new AuthenticationType();
$authenticationTypeArray = $authenticationTypeObj->allAsArray();
//get all access methods for output in drop down
$accessMethodArray = array();
$accessMethodObj = new AccessMethod();
$accessMethodArray = $accessMethodObj->allAsArray();
//get all user limits for output in drop down
//overridden for better sort
$userLimitArray = array();
$userLimitObj = new UserLimit();
$userLimitArray = $userLimitObj->allAsArray();
//get all storage locations for output in drop down
$storageLocationArray = array();
$storageLocationObj = new StorageLocation();
$storageLocationArray = $storageLocationObj->allAsArray();
//get all administering sites for output in checkboxes
$administeringSiteArray = array();
$administeringSiteObj = new AdministeringSite();
$administeringSiteArray = $administeringSiteObj->allAsArray();
//get administering sites for this resource
$sanitizedInstance = array();
$instance = new AdministeringSite();
$resourceAdministeringSiteArray = array();
foreach ($resource->getResourceAdministeringSites() as $instance) {
    $resourceAdministeringSiteArray[] = $instance->administeringSiteID;
Exemplo n.º 4
0
<?php

use Concrete\Core\Attribute\Key\Key;
use Concrete\Core\Http\ResponseAssetGroup;
defined('C5_EXECUTE') or die('Access denied.');
$r = ResponseAssetGroup::get();
$r->requireAsset('javascript', 'underscore');
$r->requireAsset('javascript', 'core/events');
$activeAuths = AuthenticationType::getList(true, true);
$form = Loader::helper('form');
$active = null;
if ($authType) {
    $active = $authType;
    $activeAuths = array($authType);
}
$image = date('Ymd') . '.jpg';
/** @var Key[] $required_attributes */
$attribute_mode = isset($required_attributes) && count($required_attributes);
?>

<div class="login-page">
    <div class="col-sm-6 col-sm-offset-3">
        <h1><?php 
echo !$attribute_mode ? t('Sign In.') : t('Required Attributes');
?>
</h1>
    </div>
    <div class="col-sm-6 col-sm-offset-3 login-form">
        <div class="row">
            <div class="visible-xs ccm-authentication-type-select form-group text-center">
                <?php 
Exemplo n.º 5
0
	</tr>


	<tr>
	<td class='searchRow'><label for='searchAuthenticationTypeID'><b>Authentication Type</b></label>
	<br />
	<select name='search[authenticationTypeID]' id='searchAuthenticationTypeID' style='width:150px'>
	<option value=''>All</option>
	<?php 
if ($search['authenticationTypeID'] == "none") {
    echo "<option value='none' selected>(none)</option>";
} else {
    echo "<option value='none'>(none)</option>";
}
$display = array();
$authenticationType = new AuthenticationType();
foreach ($authenticationType->allAsArray() as $display) {
    if ($search['authenticationTypeID'] == $display['authenticationTypeID']) {
        echo "<option value='" . $display['authenticationTypeID'] . "' selected>" . $display['shortName'] . "</option>";
    } else {
        echo "<option value='" . $display['authenticationTypeID'] . "'>" . $display['shortName'] . "</option>";
    }
}
?>
	</select>
	</td>
	</tr>
	
	<tr>
	<td class='searchRow'><label for='searchCatalogingStatusID'><b>Cataloging Status</b></label>
	<br />
Exemplo n.º 6
0
}
?>

<!-- user login -->
<?php 
if (!$u->isLoggedIn()) {
    ?>
  <div class="row customer-login-toggle-wrap">
    <div class="col-xs-12">
      <!-- if user not logged in we provide them with login form -->
      <div class="customer-login-toggle">
        Returning customer? Click here to login >>
      </div>
      <div class="customer-login-form-wrap">
        <?php 
    $standardAuth = AuthenticationType::getByHandle('concrete');
    $standardAuth->renderForm($authTypeElement ?: 'form', $authTypeParams ?: array());
    ?>
      </div>
    </div>
  </div>
<?php 
}
?>

<!-- open checkout form -->
<form action="<?php 
print $form->action('/checkout/pay');
?>
" id="checkout-form" method="post">
  <?php