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
4f0089bb
Commit
4f0089bb
authored
Apr 07, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Microsoft Live OAuth2 client added.
parent
7f0ab92d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
7 deletions
+94
-7
AuthAction.php
extensions/authclient/AuthAction.php
+0
-7
Live.php
extensions/authclient/clients/Live.php
+94
-0
No files found.
extensions/authclient/AuthAction.php
View file @
4f0089bb
...
...
@@ -209,7 +209,6 @@ class AuthAction extends Action
if
(
$response
instanceof
Response
)
{
return
$response
;
}
return
$this
->
redirectSuccess
();
}
...
...
@@ -233,7 +232,6 @@ class AuthAction extends Action
];
$response
=
Yii
::
$app
->
getResponse
();
$response
->
content
=
Yii
::
$app
->
getView
()
->
renderFile
(
$viewFile
,
$viewData
);
return
$response
;
}
...
...
@@ -247,7 +245,6 @@ class AuthAction extends Action
if
(
$url
===
null
)
{
$url
=
$this
->
getSuccessUrl
();
}
return
$this
->
redirect
(
$url
);
}
...
...
@@ -261,7 +258,6 @@ class AuthAction extends Action
if
(
$url
===
null
)
{
$url
=
$this
->
getCancelUrl
();
}
return
$this
->
redirect
(
$url
,
false
);
}
...
...
@@ -292,7 +288,6 @@ class AuthAction extends Action
}
}
else
{
$url
=
$client
->
buildAuthUrl
();
return
Yii
::
$app
->
getResponse
()
->
redirect
(
$url
);
}
...
...
@@ -325,7 +320,6 @@ class AuthAction extends Action
}
else
{
// Upgrade to access token.
$client
->
fetchAccessToken
();
return
$this
->
authSuccess
(
$client
);
}
}
...
...
@@ -366,7 +360,6 @@ class AuthAction extends Action
}
}
else
{
$url
=
$client
->
buildAuthUrl
();
return
Yii
::
$app
->
getResponse
()
->
redirect
(
$url
);
}
}
...
...
extensions/authclient/clients/Live.php
0 → 100644
View file @
4f0089bb
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\authclient\clients
;
use
yii\authclient\OAuth2
;
/**
* Live allows authentication via Microsoft Live OAuth.
*
* In order to use Microsoft Live OAuth you must register your application at <https://account.live.com/developers/applications>
*
* Example application configuration:
*
* ~~~
* 'components' => [
* 'authClientCollection' => [
* 'class' => 'yii\authclient\Collection',
* 'clients' => [
* 'live' => [
* 'class' => 'yii\authclient\clients\Live',
* 'clientId' => 'live_client_id',
* 'clientSecret' => 'live_client_secret',
* ],
* ],
* ]
* ...
* ]
* ~~~
*
* @see https://account.live.com/developers/applications
* @see http://msdn.microsoft.com/en-us/library/live/hh243647.aspx
*
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
class
Live
extends
OAuth2
{
/**
* @inheritdoc
*/
public
$authUrl
=
'https://login.live.com/oauth20_authorize.srf'
;
/**
* @inheritdoc
*/
public
$tokenUrl
=
'https://login.live.com/oauth20_token.srf'
;
/**
* @inheritdoc
*/
public
$apiBaseUrl
=
'https://apis.live.net/v5.0'
;
/**
* @inheritdoc
*/
public
function
init
()
{
parent
::
init
();
if
(
$this
->
scope
===
null
)
{
$this
->
scope
=
implode
(
','
,
[
'wl.basic'
,
'wl.emails'
,
]);
}
}
/**
* @inheritdoc
*/
protected
function
initUserAttributes
()
{
return
$this
->
api
(
'me'
,
'GET'
);
}
/**
* @inheritdoc
*/
protected
function
defaultName
()
{
return
'live'
;
}
/**
* @inheritdoc
*/
protected
function
defaultTitle
()
{
return
'Live'
;
}
}
\ No newline at end of file
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