Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
Easy Http SDK
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Back End
Easy Http SDK
Commits
659c7772
Commit
659c7772
authored
Nov 03, 2023
by
李晓东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改授权方式
parent
7e3b5e67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
Application.php
src/Application.php
+18
-23
No files found.
src/Application.php
View file @
659c7772
...
@@ -29,9 +29,6 @@ class Application implements ClientInterface
...
@@ -29,9 +29,6 @@ class Application implements ClientInterface
private
const
TOKEN_CACHE_KEY
=
"Auth.%s"
;
private
const
TOKEN_CACHE_KEY
=
"Auth.%s"
;
/** @var string jwtToken */
private
$jwtToken
=
""
;
/** @var Option $option */
/** @var Option $option */
private
$option
;
private
$option
;
...
@@ -158,9 +155,10 @@ class Application implements ClientInterface
...
@@ -158,9 +155,10 @@ class Application implements ClientInterface
$stack
->
push
(
$middleware
);
$stack
->
push
(
$middleware
);
}
}
if
(
$request
->
authorization
())
{
if
(
$request
->
authorization
())
{
if
(
$this
->
jwtToken
===
""
)
{
try
{
try
{
$this
->
jwtToken
=
$this
->
getAccessTokenFromCache
();
$jwtToken
=
$this
->
getAccessTokenFromCache
();
$authMiddleware
=
$this
->
option
->
getAuthorizationMiddleware
();
$stack
->
push
(
new
$authMiddleware
(
$jwtToken
));
}
catch
(
CacheInvalidArgumentException
$exception
)
{
}
catch
(
CacheInvalidArgumentException
$exception
)
{
// 缓存异常
// 缓存异常
throw
new
ApplicationException
(
"auth cache error "
.
$exception
->
getMessage
());
throw
new
ApplicationException
(
"auth cache error "
.
$exception
->
getMessage
());
...
@@ -178,9 +176,6 @@ class Application implements ClientInterface
...
@@ -178,9 +176,6 @@ class Application implements ClientInterface
throw
new
ApplicationException
(
$exception
->
getMessage
(),
$request
,
[],
$exception
);
throw
new
ApplicationException
(
$exception
->
getMessage
(),
$request
,
[],
$exception
);
}
}
}
}
$authMiddleware
=
$this
->
option
->
getAuthorizationMiddleware
();
$stack
->
push
(
new
$authMiddleware
(
$this
->
jwtToken
));
}
}
}
$options
=
[
$options
=
[
...
...
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