Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
c1a810ba
Commit
c1a810ba
authored
Dec 25, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation at "yii\authclient" updated.
parent
d8079cc6
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
257 additions
and
2 deletions
+257
-2
README.md
extensions/yii/authclient/README.md
+55
-2
Facebook.php
extensions/yii/authclient/clients/Facebook.php
+35
-0
GitHub.php
extensions/yii/authclient/clients/GitHub.php
+18
-0
GoogleOAuth.php
extensions/yii/authclient/clients/GoogleOAuth.php
+18
-0
GoogleOpenId.php
extensions/yii/authclient/clients/GoogleOpenId.php
+16
-0
LinkedIn.php
extensions/yii/authclient/clients/LinkedIn.php
+35
-0
Twitter.php
extensions/yii/authclient/clients/Twitter.php
+35
-0
YandexOAuth.php
extensions/yii/authclient/clients/YandexOAuth.php
+18
-0
YandexOpenId.php
extensions/yii/authclient/clients/YandexOpenId.php
+16
-0
authchoice.js
extensions/yii/authclient/widgets/assets/authchoice.js
+11
-0
No files found.
extensions/yii/authclient/README.md
View file @
c1a810ba
...
...
@@ -27,4 +27,57 @@ to the require section of your composer.json.
Usage & Documentation
---------------------
This extension...
\ No newline at end of file
This extension provides the ability of the authentication via external credentials providers.
It covers OpenID, OAuth1 and OAuth2 protocols.
You need to setup auth client collection application component:
```
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleOpenId'
],
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'clientId' => 'facebook_client_id',
'clientSecret' => 'facebook_client_secret',
],
],
]
...
]
```
Then you need to apply
[
[yii\authclient\AuthAction
]
] to some of your web controllers:
```
class SiteController extends Controller
{
public function actions()
{
return [
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'successCallback'],
],
]
}
public function successCallback($client)
{
$atributes = $client->getUserAttributes();
// user login or signup comes here
}
}
```
You may use
[
[yii\authclient\widgets\Choice
]
] to compose auth client selection:
```
<?= yii\authclient\Choice::widget([
'baseAuthUrl' => ['site/auth']
]); ?>
```
\ No newline at end of file
extensions/yii/authclient/clients/Facebook.php
View file @
c1a810ba
...
...
@@ -13,6 +13,24 @@ use yii\authclient\OAuth2;
* Facebook allows authentication via Facebook OAuth.
* In order to use Facebook OAuth you must register your application at [[https://developers.facebook.com/apps]].
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'facebook' => [
* 'class' => 'yii\authclient\clients\Facebook',
* 'clientId' => 'facebook_client_id',
* 'clientSecret' => 'facebook_client_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see https://developers.facebook.com/apps
* @see http://developers.facebook.com/docs/reference/api
*
...
...
@@ -45,4 +63,20 @@ class Facebook extends OAuth2
{
return
$this
->
api
(
'me'
,
'GET'
);
}
/**
* @inheritdoc
*/
protected
function
defaultName
()
{
return
'facebook'
;
}
/**
* @inheritdoc
*/
protected
function
defaultTitle
()
{
return
'Facebook'
;
}
}
\ No newline at end of file
extensions/yii/authclient/clients/GitHub.php
View file @
c1a810ba
...
...
@@ -13,6 +13,24 @@ use yii\authclient\OAuth2;
* GitHub allows authentication via GitHub OAuth.
* In order to use GitHub OAuth you must register your application at [[https://github.com/settings/applications/new]].
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'github' => [
* 'class' => 'yii\authclient\clients\GitHub',
* 'clientId' => 'github_client_id',
* 'clientSecret' => 'github_client_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see http://developer.github.com/v3/oauth/
* @see https://github.com/settings/applications/new
*
...
...
extensions/yii/authclient/clients/GoogleOAuth.php
View file @
c1a810ba
...
...
@@ -13,6 +13,24 @@ use yii\authclient\OAuth2;
* GoogleOAuth allows authentication via Google OAuth.
* In order to use Google OAuth you must register your application at [[https://code.google.com/apis/console#access]].
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'google' => [
* 'class' => 'yii\authclient\clients\GoogleOAuth',
* 'clientId' => 'google_client_id',
* 'clientSecret' => 'google_client_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see https://code.google.com/apis/console#access
* @see https://developers.google.com/google-apps/contacts/v3/
*
...
...
extensions/yii/authclient/clients/GoogleOpenId.php
View file @
c1a810ba
...
...
@@ -13,6 +13,22 @@ use yii\authclient\OpenId;
* GoogleOpenId allows authentication via Google OpenId.
* Unlike Google OAuth you do not need to register your application anywhere in order to use Google OpenId.
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'google' => [
* 'class' => 'yii\authclient\clients\GoogleOpenId'
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
...
...
extensions/yii/authclient/clients/LinkedIn.php
View file @
c1a810ba
...
...
@@ -15,6 +15,24 @@ use Yii;
* LinkedIn allows authentication via LinkedIn OAuth.
* In order to use linkedIn OAuth you must register your application at [[https://www.linkedin.com/secure/developer]].
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'linkedin' => [
* 'class' => 'yii\authclient\clients\LinkedIn',
* 'clientId' => 'linkedin_client_id',
* 'clientSecret' => 'linkedin_client_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see http://developer.linkedin.com/documents/authentication
* @see https://www.linkedin.com/secure/developer
* @see http://developer.linkedin.com/apis
...
...
@@ -130,4 +148,20 @@ class LinkedIn extends OAuth2
protected
function
generateAuthState
()
{
return
sha1
(
uniqid
(
get_class
(
$this
),
true
));
}
/**
* @inheritdoc
*/
protected
function
defaultName
()
{
return
'linkedin'
;
}
/**
* @inheritdoc
*/
protected
function
defaultTitle
()
{
return
'LinkedIn'
;
}
}
\ No newline at end of file
extensions/yii/authclient/clients/Twitter.php
View file @
c1a810ba
...
...
@@ -13,6 +13,24 @@ use yii\authclient\OAuth1;
* Twitter allows authentication via Twitter OAuth.
* In order to use Twitter OAuth you must register your application at [[https://dev.twitter.com/apps/new]].
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'twitter' => [
* 'class' => 'yii\authclient\clients\Twitter',
* 'consumerKey' => 'twitter_consumer_key',
* 'consumerSecret' => 'twitter_consumer_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see https://dev.twitter.com/apps/new
* @see https://dev.twitter.com/docs/api
*
...
...
@@ -53,4 +71,20 @@ class Twitter extends OAuth1
{
return
$this
->
api
(
'account/verify_credentials.json'
,
'GET'
);
}
/**
* @inheritdoc
*/
protected
function
defaultName
()
{
return
'twitter'
;
}
/**
* @inheritdoc
*/
protected
function
defaultTitle
()
{
return
'Twitter'
;
}
}
\ No newline at end of file
extensions/yii/authclient/clients/YandexOAuth.php
View file @
c1a810ba
...
...
@@ -13,6 +13,24 @@ use yii\authclient\OAuth2;
* YandexOAuth allows authentication via Yandex OAuth.
* In order to use Yandex OAuth you must register your application at [[https://oauth.yandex.ru/client/new]].
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'yandex' => [
* 'class' => 'yii\authclient\clients\YandexOAuth',
* 'clientId' => 'yandex_client_id',
* 'clientSecret' => 'yandex_client_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see https://oauth.yandex.ru/client/new
* @see http://api.yandex.ru/login/doc/dg/reference/response.xml
*
...
...
extensions/yii/authclient/clients/YandexOpenId.php
View file @
c1a810ba
...
...
@@ -13,6 +13,22 @@ use yii\authclient\OpenId;
* YandexOpenId allows authentication via Yandex OpenId.
* Unlike Yandex OAuth you do not need to register your application anywhere in order to use Yandex OpenId.
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'yandex' => [
* 'class' => 'yii\authclient\clients\YandexOpenId'
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
...
...
extensions/yii/authclient/widgets/assets/authchoice.js
View file @
c1a810ba
/**
* Yii auth choice widget.
*
* This is the JavaScript widget used by the yii\authclient\widgets\Choice widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
jQuery
(
function
(
$
)
{
$
.
fn
.
authchoice
=
function
(
options
)
{
options
=
$
.
extend
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment