Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
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
王衍超
cloud-fb
Commits
536b9ba9
Commit
536b9ba9
authored
Jul 14, 2021
by
shiwenbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购砂单位用户、场站用户和司机用户增加校验是否停用逻辑
parent
d25ae9df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
DriverUserAuthProvider.java
...e/inz/authentication/provider/DriverUserAuthProvider.java
+14
-0
SandUserAuthProvider.java
...ode/inz/authentication/provider/SandUserAuthProvider.java
+12
-0
WarehouseUserAuthenticationProvider.java
...ication/provider/WarehouseUserAuthenticationProvider.java
+12
-0
No files found.
backend/inz.authentication/src/main/java/com/beecode/inz/authentication/provider/DriverUserAuthProvider.java
View file @
536b9ba9
...
...
@@ -2,14 +2,17 @@ package com.beecode.inz.authentication.provider;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.authentication.AuthenticationProvider
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.DisabledException
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
com.beecode.inz.basis.pojo.DriverUser
;
import
com.beecode.inz.basis.service.DriverUserService
;
...
...
@@ -36,6 +39,8 @@ public class DriverUserAuthProvider implements AuthenticationProvider {
throw
new
BadCredentialsException
(
"用户名或密码错误!"
);
}
checkUserState
(
driverUser
);
String
pwd
=
driverUser
.
getPassword
();
if
(!
passwordEncoder
.
matches
(
passWord
,
pwd
))
{
throw
new
BadCredentialsException
(
"密码错误!"
);
...
...
@@ -48,4 +53,13 @@ public class DriverUserAuthProvider implements AuthenticationProvider {
public
boolean
supports
(
Class
<?>
authentication
)
{
return
authentication
!=
null
&&
authentication
==
UsernamePasswordAuthenticationToken
.
class
;
}
private
void
checkUserState
(
DriverUser
driverUser
)
{
if
(
null
==
driverUser
)
return
;
if
(!
driverUser
.
isEnabled
())
{
throw
new
DisabledException
(
"该用户被停用,无法登录业务,请联系系统管理员。"
);
}
}
}
backend/inz.authentication/src/main/java/com/beecode/inz/authentication/provider/SandUserAuthProvider.java
View file @
536b9ba9
...
...
@@ -6,6 +6,7 @@ import java.util.List;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.authentication.AuthenticationProvider
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.DisabledException
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.AuthenticationException
;
...
...
@@ -38,6 +39,8 @@ public class SandUserAuthProvider implements AuthenticationProvider {
throw
new
BadCredentialsException
(
"用户名或密码错误!"
);
}
checkUserState
(
sandUser
);
String
pwd
=
sandUser
.
getPassword
();
if
(!
passwordEncoder
.
matches
(
passWord
,
pwd
))
{
throw
new
BadCredentialsException
(
"密码错误!"
);
...
...
@@ -50,4 +53,13 @@ public class SandUserAuthProvider implements AuthenticationProvider {
public
boolean
supports
(
Class
<?>
authentication
)
{
return
authentication
!=
null
&&
authentication
==
UsernamePasswordAuthenticationToken
.
class
;
}
private
void
checkUserState
(
SandUser
sandUser
)
{
if
(
null
==
sandUser
)
return
;
if
(!
sandUser
.
isEnabled
())
{
throw
new
DisabledException
(
"该用户被停用,无法登录业务,请联系系统管理员。"
);
}
}
}
backend/inz.authentication/src/main/java/com/beecode/inz/authentication/provider/WarehouseUserAuthenticationProvider.java
View file @
536b9ba9
...
...
@@ -6,6 +6,7 @@ import java.util.List;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.authentication.AuthenticationProvider
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.DisabledException
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.AuthenticationException
;
...
...
@@ -38,6 +39,8 @@ public class WarehouseUserAuthenticationProvider implements AuthenticationProvi
throw
new
BadCredentialsException
(
"用户名或密码错误!"
);
}
checkUserState
(
warehouseUser
);
String
pwd
=
warehouseUser
.
getPassword
();
if
(!
passwordEncoder
.
matches
(
passWord
,
pwd
))
{
throw
new
BadCredentialsException
(
"用户名或密码错误!"
);
...
...
@@ -50,4 +53,13 @@ public class WarehouseUserAuthenticationProvider implements AuthenticationProvi
public
boolean
supports
(
Class
<?>
authentication
)
{
return
authentication
!=
null
&&
authentication
==
UsernamePasswordAuthenticationToken
.
class
;
}
private
void
checkUserState
(
WarehouseUser
warehouseUser
)
{
if
(
null
==
warehouseUser
)
return
;
if
(!
warehouseUser
.
isEnabled
())
{
throw
new
DisabledException
(
"该用户被停用,无法登录业务,请联系系统管理员。"
);
}
}
}
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