Вход Регистрация
Файл: concrete5.7.5.6/concrete/src/Authentication/Type/Google/ServiceProvider.php
Строк: 45
<?php
namespace ConcreteCoreAuthenticationTypeGoogle;

use 
ConcreteCoreApplicationApplication;
use 
Config;
use 
OAuthCommonConsumerCredentials;
use 
OAuthCommonStorageSymfonySession;
use 
OAuthOAuth2ServiceGoogle;
use 
OAuthServiceFactory;
use 
OAuthUserDataExtractorFactory;

class 
ServiceProvider extends ConcreteCoreFoundationServiceProvider
{

    
/**
     * Register the service provider.
     *
     * @return void
     */
    
public function register()
    {
        
/** @var ExtractorFactory $factory */
        
$extractor $this->app->make('oauth/factory/extractor');
        
$extractor->addExtractorMapping(
            
'OAuth\OAuth2\Service\Google',
            
'Concrete\Core\Authentication\Type\Google\Extractor\Google');

        
$this->app->bindShared(
            
'authentication/google',
            function (
Application $app$callback '/ccm/system/authentication/oauth2/google/callback/') {
                
/** @var ServiceFactory $factory */
                
$factory $app->make('oauth/factory/service', array(CURLOPT_SSL_VERIFYPEER => Config::get('app.curl.verifyPeer')));

                return 
$factory->createService(
                    
'google',
                    new 
Credentials(
                        
Config::get('auth.google.appid'),
                        
Config::get('auth.google.secret'),
                        (string) 
URL::to($callback)
                    ),
                    new 
SymfonySession(Session::getFacadeRoot(), false),
                    array(
Google::SCOPE_EMAILGoogle::SCOPE_PROFILE));
            }
        );
    }

}
Онлайн: 1
Реклама