Compare commits
No commits in common. "main" and "v2.1.13" have entirely different histories.
|
@ -14,5 +14,11 @@
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/support": "^5.5",
|
"illuminate/support": "^5.5",
|
||||||
"paidian/json-rpc": "~1.1"
|
"paidian/json-rpc": "~1.1"
|
||||||
|
},
|
||||||
|
"repositories": {
|
||||||
|
"php-json-rpc": {
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "git@git.int.haowumc.com:composer/php-json-rpc.git"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1521
composer.lock
generated
Normal file
1521
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -41,11 +41,8 @@ class Authenticate
|
||||||
{
|
{
|
||||||
//登录状态检测
|
//登录状态检测
|
||||||
if ($this->auth->guard($guard)->guest()) {
|
if ($this->auth->guard($guard)->guest()) {
|
||||||
$redirect = $request->input('redirect');
|
$redirect = $request->input('redirect', $request->header('referer'));
|
||||||
if ($request->isXmlHttpRequest()) {
|
// if ($request->isXmlHttpRequest()) {
|
||||||
if( $redirect == null ){
|
|
||||||
$redirect = $request->header('referer');
|
|
||||||
}
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => config('pdauth.code.unauthorized', 401),
|
'code' => config('pdauth.code.unauthorized', 401),
|
||||||
'msg' => 'Unauthorized',
|
'msg' => 'Unauthorized',
|
||||||
|
@ -53,12 +50,9 @@ class Authenticate
|
||||||
'url' => app('pd.auth')->connect($redirect),
|
'url' => app('pd.auth')->connect($redirect),
|
||||||
],
|
],
|
||||||
],401);
|
],401);
|
||||||
} else {
|
// } else {
|
||||||
if( $redirect == null ){
|
// return redirect(app('pd.auth')->connect($redirect));
|
||||||
$redirect = $request->getSchemeAndHttpHost()."/api/auth/token.html";
|
// }
|
||||||
}
|
|
||||||
return redirect(app('pd.auth')->connect($redirect));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace PdAuth;
|
namespace PdAuth;
|
||||||
|
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use PdAuth\Middleware\Authenticate;
|
use PdAuth\Middleware\Authenticate;
|
||||||
|
@ -70,14 +69,6 @@ class PdAuthServiceProvider extends ServiceProvider
|
||||||
])->withCookie($cookie);
|
])->withCookie($cookie);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->app['router']->get('api/auth/token.html', function (Request $request) {
|
|
||||||
$code = $request->input('pd_code');
|
|
||||||
$id = $request->input('app_id');
|
|
||||||
$token = app('pd.auth')->choose(null, $id)->getAccessToken($code);
|
|
||||||
$cookie = new Cookie(Authenticate::CookieName, $token['access_token'], strtotime($token['expired_at']));
|
|
||||||
return RedirectResponse::create('/')->withCookie($cookie);
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->app['router']->get('api/auth/logout', function (Request $request) {
|
$this->app['router']->get('api/auth/logout', function (Request $request) {
|
||||||
$cookie = new Cookie(Authenticate::CookieName, '', time());
|
$cookie = new Cookie(Authenticate::CookieName, '', time());
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|
Loading…
Reference in New Issue
Block a user