Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
Overview
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
吴迪
gs1-office-web-sit
Commits
3334283f
Commit
3334283f
authored
Dec 13, 2021
by
唐功亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改】 OAuth2Realm.java
parent
034976e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
pom.xml
pom.xml
+0
-3
OAuth2Realm.java
src/main/java/io/office/modules/sys/oauth2/OAuth2Realm.java
+9
-3
No files found.
pom.xml
View file @
3334283f
...
...
@@ -287,15 +287,12 @@
<dependency>
<groupId>
net.sf.barcode4j
</groupId>
<artifactId>
barcode4j
</artifactId>
<version>
2.2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
net.sf.barcode4j
</groupId>
<artifactId>
barcode4j-light
</artifactId>
<version>
2.2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
net.sf.barcode4j
</groupId>
...
...
src/main/java/io/office/modules/sys/oauth2/OAuth2Realm.java
View file @
3334283f
...
...
@@ -8,6 +8,8 @@
package
io
.
office
.
modules
.
sys
.
oauth2
;
import
io.office.modules.manage.dao.MemberDao
;
import
io.office.modules.manage.entity.MemberEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
io.office.modules.sys.entity.SysUserTokenEntity
;
import
io.office.modules.sys.service.ShiroService
;
...
...
@@ -30,7 +32,8 @@ import java.util.Set;
public
class
OAuth2Realm
extends
AuthorizingRealm
{
@Autowired
private
ShiroService
shiroService
;
@Autowired
private
MemberDao
memberDao
;
@Override
public
boolean
supports
(
AuthenticationToken
token
)
{
return
token
instanceof
OAuth2Token
;
...
...
@@ -67,19 +70,22 @@ public class OAuth2Realm extends AuthorizingRealm {
}
//查询用户信息
SysUserEntity
user
=
null
;
SimpleAuthenticationInfo
info
=
null
;
if
(
accessToken
.
startsWith
(
"qianduan_"
))
{
//todo
MemberEntity
memberEntity
=
memberDao
.
selectById
(
tokenEntity
.
getUserId
());
new
SimpleAuthenticationInfo
(
memberEntity
,
accessToken
,
getName
());
}
else
{
user
=
shiroService
.
queryUser
(
tokenEntity
.
getUserId
());
//账号锁定
if
(
user
.
getStatus
()
==
0
){
throw
new
LockedAccountException
(
"账号已被锁定,请联系管理员"
);
}
new
SimpleAuthenticationInfo
(
user
,
accessToken
,
getName
());
}
SimpleAuthenticationInfo
info
=
new
SimpleAuthenticationInfo
(
user
,
accessToken
,
getName
());
//
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, accessToken, getName());
return
info
;
}
}
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