Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loginservice
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
lanmw
loginservice
Commits
e4f80335
Commit
e4f80335
authored
Aug 05, 2024
by
chenzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改】环境JDK21,language19,springboot版本升级
parent
e36ae21d
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
90 additions
and
71 deletions
+90
-71
pom.xml
pom.xml
+24
-20
LoginManagement.java
src/main/java/com/keymobile/login/api/LoginManagement.java
+14
-11
LogoutProcessHandler.java
...n/java/com/keymobile/login/conf/LogoutProcessHandler.java
+5
-5
RESTAuthenticationEntryPoint.java
...om/keymobile/login/conf/RESTAuthenticationEntryPoint.java
+3
-3
RESTAuthenticationFailureHandler.java
...eymobile/login/conf/RESTAuthenticationFailureHandler.java
+3
-3
RESTAuthenticationSuccessHandler.java
...eymobile/login/conf/RESTAuthenticationSuccessHandler.java
+3
-3
RESTLogoutSuccessHandler.java
...va/com/keymobile/login/conf/RESTLogoutSuccessHandler.java
+3
-4
SecurityConfig.java
src/main/java/com/keymobile/login/conf/SecurityConfig.java
+11
-22
UserDetailsServiceImpl.java
...a/com/keymobile/login/service/UserDetailsServiceImpl.java
+24
-0
No files found.
pom.xml
View file @
e4f80335
...
@@ -11,15 +11,15 @@
...
@@ -11,15 +11,15 @@
<parent>
<parent>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.0.4.RELEASE
</version>
<version>
3.0.13
</version>
<relativePath/>
<relativePath
/>
</parent>
</parent>
<properties>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<!--<java.version>1.8</java.version>-->
<!--<java.version>1.8</java.version>-->
<spring-cloud.version>
Finchley.RELEASE
</spring-cloud.version>
<spring-cloud.version>
2022.0.3
</spring-cloud.version>
</properties>
</properties>
<!-- <repositories>-->
<!-- <repositories>-->
<!-- <repository>-->
<!-- <repository>-->
...
@@ -32,6 +32,10 @@
...
@@ -32,6 +32,10 @@
<dependencies>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-bootstrap
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
commons-io
</groupId>
<groupId>
commons-io
</groupId>
...
@@ -52,10 +56,10 @@
...
@@ -52,10 +56,10 @@
<version>
1.2
</version>
<version>
1.2
</version>
</dependency>
</dependency>
<dependency>
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</dependency>
-->
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -67,22 +71,22 @@
...
@@ -67,22 +71,22 @@
<artifactId>
commons-lang3
</artifactId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.7
</version>
<version>
3.7
</version>
</dependency>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger2</artifactId>-->
<!-- <version>2.5.0</version>-->
<!-- </dependency>-->
<dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<groupId>
org.springdoc
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<artifactId>
springdoc-openapi-starter-webmvc-ui
</artifactId>
<version>
2.5.0
</version>
<version>
2.0.3
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.2.2
</version>
</dependency>
</dependency>
<!--引入oauth2-->
<!--引入oauth2-->
<dependency
>
<!-- <dependency>--
>
<groupId>
com.fasterxml.jackson.core
</groupId
>
<!-- <groupId>com.fasterxml.jackson.core</groupId>--
>
<artifactId>
jackson-core
</artifactId
>
<!-- <artifactId>jackson-core</artifactId>--
>
<version>
2.10.2
</version
>
<!-- <version>2.10.2</version>--
>
</dependency
>
<!-- </dependency>--
>
<dependency>
<dependency>
<groupId>
com.auth0
</groupId>
<groupId>
com.auth0
</groupId>
<artifactId>
java-jwt
</artifactId>
<artifactId>
java-jwt
</artifactId>
...
@@ -160,13 +164,13 @@
...
@@ -160,13 +164,13 @@
<dependency>
<dependency>
<groupId>
com.keymobile.auth
</groupId>
<groupId>
com.keymobile.auth
</groupId>
<artifactId>
security
</artifactId>
<artifactId>
security
</artifactId>
<version>
3.0.12-release
</version>
<version>
mr-1.0.0-beta
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.keymobile
</groupId>
<groupId>
com.keymobile
</groupId>
<artifactId>
config
</artifactId>
<artifactId>
config
</artifactId>
<version>
1.1.2-release
</version>
<version>
mr-1.0.9-beta
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
src/main/java/com/keymobile/login/api/LoginManagement.java
View file @
e4f80335
...
@@ -3,9 +3,13 @@ package com.keymobile.login.api;
...
@@ -3,9 +3,13 @@ package com.keymobile.login.api;
import
com.auth0.jwt.JWT
;
import
com.auth0.jwt.JWT
;
import
com.auth0.jwt.interfaces.Claim
;
import
com.auth0.jwt.interfaces.Claim
;
import
com.auth0.jwt.interfaces.DecodedJWT
;
import
com.auth0.jwt.interfaces.DecodedJWT
;
import
com.keymobile.auth.common.security.CustomizedUserDetailService
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
com.keymobile.login.service.AuthService
;
import
com.keymobile.login.service.AuthService
;
import
com.keymobile.login.service.UserDetailsServiceImpl
;
import
jakarta.annotation.PostConstruct
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
jakarta.servlet.http.HttpSession
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -17,14 +21,14 @@ import org.springframework.security.web.authentication.WebAuthenticationDetails;
...
@@ -17,14 +21,14 @@ import org.springframework.security.web.authentication.WebAuthenticationDetails;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -41,8 +45,7 @@ public class LoginManagement {
...
@@ -41,8 +45,7 @@ public class LoginManagement {
private
Oauth2Properties
oauth2Properties
;
private
Oauth2Properties
oauth2Properties
;
@Autowired
@Autowired
private
CustomizedUserDetailService
customizedUserDetailService
;
private
UserDetailsServiceImpl
userDetailsService
;
@Autowired
@Autowired
private
AuthService
authService
;
private
AuthService
authService
;
...
@@ -50,7 +53,7 @@ public class LoginManagement {
...
@@ -50,7 +53,7 @@ public class LoginManagement {
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
restTemplate
=
new
RestTemplateBuilder
().
basicAuth
oriz
ation
(
oauth2Properties
.
getClientId
(),
oauth2Properties
.
getClientSecret
()).
build
();
restTemplate
=
new
RestTemplateBuilder
().
basicAuth
entic
ation
(
oauth2Properties
.
getClientId
(),
oauth2Properties
.
getClientSecret
()).
build
();
}
}
@RequestMapping
(
value
=
"sessionInfo"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@RequestMapping
(
value
=
"sessionInfo"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
...
@@ -138,7 +141,7 @@ public class LoginManagement {
...
@@ -138,7 +141,7 @@ public class LoginManagement {
toAdd
.
put
(
"password"
,
"37fa265330ad83eaa879efb1e2db6380896cf639"
);
toAdd
.
put
(
"password"
,
"37fa265330ad83eaa879efb1e2db6380896cf639"
);
authService
.
addUser
(
toAdd
);
authService
.
addUser
(
toAdd
);
}
}
UserDetails
userDetails
=
customizedUserDetail
Service
.
loadUserByUsername
(
userDetailByTokenInfo
.
get
(
"unique_name"
));
UserDetails
userDetails
=
userDetails
Service
.
loadUserByUsername
(
userDetailByTokenInfo
.
get
(
"unique_name"
));
UsernamePasswordAuthenticationToken
authentication
=
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
userDetails
.
getPassword
(),
userDetails
.
getAuthorities
());
new
UsernamePasswordAuthenticationToken
(
userDetails
,
userDetails
.
getPassword
(),
userDetails
.
getAuthorities
());
authentication
.
setDetails
(
new
WebAuthenticationDetails
(
request
));
authentication
.
setDetails
(
new
WebAuthenticationDetails
(
request
));
...
...
src/main/java/com/keymobile/login/conf/LogoutProcessHandler.java
View file @
e4f80335
...
@@ -2,6 +2,10 @@ package com.keymobile.login.conf;
...
@@ -2,6 +2,10 @@ package com.keymobile.login.conf;
import
com.keymobile.login.api.Constants
;
import
com.keymobile.login.api.Constants
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
jakarta.annotation.PostConstruct
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
jakarta.servlet.http.HttpSession
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -13,10 +17,6 @@ import org.springframework.security.web.authentication.logout.LogoutHandler;
...
@@ -13,10 +17,6 @@ import org.springframework.security.web.authentication.logout.LogoutHandler;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -33,7 +33,7 @@ public class LogoutProcessHandler implements LogoutHandler {
...
@@ -33,7 +33,7 @@ public class LogoutProcessHandler implements LogoutHandler {
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
restTemplate
=
new
RestTemplateBuilder
().
basicAuth
oriz
ation
(
oauth2Properties
.
getClientId
(),
oauth2Properties
.
getClientSecret
()).
build
();
restTemplate
=
new
RestTemplateBuilder
().
basicAuth
entic
ation
(
oauth2Properties
.
getClientId
(),
oauth2Properties
.
getClientSecret
()).
build
();
MappingJackson2HttpMessageConverter
mappingJackson2HttpMessageConverter
=
new
MappingJackson2HttpMessageConverter
();
MappingJackson2HttpMessageConverter
mappingJackson2HttpMessageConverter
=
new
MappingJackson2HttpMessageConverter
();
mappingJackson2HttpMessageConverter
.
setSupportedMediaTypes
(
Arrays
.
asList
(
mappingJackson2HttpMessageConverter
.
setSupportedMediaTypes
(
Arrays
.
asList
(
MediaType
.
TEXT_HTML
,
MediaType
.
TEXT_HTML
,
...
...
src/main/java/com/keymobile/login/conf/RESTAuthenticationEntryPoint.java
View file @
e4f80335
package
com
.
keymobile
.
login
.
conf
;
package
com
.
keymobile
.
login
.
conf
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.web.AuthenticationEntryPoint
;
import
org.springframework.security.web.AuthenticationEntryPoint
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
@Component
@Component
...
...
src/main/java/com/keymobile/login/conf/RESTAuthenticationFailureHandler.java
View file @
e4f80335
package
com
.
keymobile
.
login
.
conf
;
package
com
.
keymobile
.
login
.
conf
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler
;
import
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
@Component
@Component
...
...
src/main/java/com/keymobile/login/conf/RESTAuthenticationSuccessHandler.java
View file @
e4f80335
package
com
.
keymobile
.
login
.
conf
;
package
com
.
keymobile
.
login
.
conf
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler
;
import
org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
...
...
src/main/java/com/keymobile/login/conf/RESTLogoutSuccessHandler.java
View file @
e4f80335
package
com
.
keymobile
.
login
.
conf
;
package
com
.
keymobile
.
login
.
conf
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.web.authentication.logout.LogoutSuccessHandler
;
import
org.springframework.security.web.authentication.logout.LogoutSuccessHandler
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
@Component
@Component
...
...
src/main/java/com/keymobile/login/conf/SecurityConfig.java
View file @
e4f80335
package
com
.
keymobile
.
login
.
conf
;
package
com
.
keymobile
.
login
.
conf
;
import
com.keymobile.auth.common.security.CustomizedUserDetailService
;
import
com.keymobile.login.service.UserDetailsServiceImpl
;
import
com.keymobile.login.api.Constants
;
import
com.keymobile.login.oauth2.Oauth2Properties
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.crypto.password.NoOpPasswordEncoder
;
import
org.springframework.security.crypto.password.NoOpPasswordEncoder
;
import
org.springframework.security.web.authentication.logout.LogoutHandler
;
import
org.springframework.security.web.SecurityFilterChain
;
import
org.springframework.web.client.RestTemplate
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
java.util.HashMap
;
import
java.util.Map
;
@Configuration
@Configuration
@ComponentScan
(
"com.keymobile.auth.common.security"
)
@ComponentScan
(
"com.keymobile.auth.common.security"
)
public
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
public
class
SecurityConfig
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
SecurityConfig
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
SecurityConfig
.
class
);
@Autowired
@Autowired
private
CustomizedUserDetailService
customUserDetail
Service
;
private
UserDetailsServiceImpl
userDetails
Service
;
@Autowired
@Autowired
private
RESTAuthenticationEntryPoint
authenticationEntryPoint
;
private
RESTAuthenticationEntryPoint
authenticationEntryPoint
;
@Autowired
@Autowired
...
@@ -45,15 +33,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -45,15 +33,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
@Autowired
public
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
public
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
userDetailsService
(
customUserDetail
Service
).
passwordEncoder
(
NoOpPasswordEncoder
.
getInstance
());
auth
.
userDetailsService
(
userDetails
Service
).
passwordEncoder
(
NoOpPasswordEncoder
.
getInstance
());
}
}
@
Override
@
Bean
p
rotected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
p
ublic
SecurityFilterChain
securityFilterChain
(
HttpSecurity
http
)
throws
Exception
{
// http.authorizeRequests().anyRequest().authenticated();
// http.authorizeRequests().anyRequest().authenticated();
http
http
.
authorizeRequests
()
.
authorize
Http
Requests
()
.
an
tMatchers
(
"/login"
,
"/error"
,
"/signin"
,
"/signout"
,
"/oauth/**"
).
permitAll
()
.
reques
tMatchers
(
"/login"
,
"/error"
,
"/signin"
,
"/signout"
,
"/oauth/**"
).
permitAll
()
.
anyRequest
().
authenticated
();
.
anyRequest
().
authenticated
();
http
.
csrf
().
disable
();
http
.
csrf
().
disable
();
...
@@ -64,6 +52,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -64,6 +52,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
http
.
formLogin
().
loginProcessingUrl
(
"/signin"
);
http
.
formLogin
().
loginProcessingUrl
(
"/signin"
);
http
.
logout
().
logoutUrl
(
"/signout"
);
http
.
logout
().
logoutUrl
(
"/signout"
);
http
.
logout
().
logoutSuccessHandler
(
logoutSuccessHandler
);
http
.
logout
().
logoutSuccessHandler
(
logoutSuccessHandler
);
return
http
.
build
();
}
}
...
...
src/main/java/com/keymobile/login/service/UserDetailsServiceImpl.java
0 → 100644
View file @
e4f80335
package
com
.
keymobile
.
login
.
service
;
import
jakarta.annotation.PostConstruct
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
javax.sql.DataSource
;
@Repository
public
class
UserDetailsServiceImpl
extends
JdbcDaoImpl
implements
UserDetailsService
{
@Autowired
private
DataSource
dataSource
;
/**
* 初始化时,设置给父类
*/
@PostConstruct
private
void
initialize
()
{
setDataSource
(
dataSource
);
}
}
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