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
0f5bff1d
Commit
0f5bff1d
authored
Sep 02, 2019
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交loginService修改代码。
parent
e4b4a2b6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
15 deletions
+62
-15
LoginApplication.java
src/main/java/com/keymobile/proxy/LoginApplication.java
+2
-0
LoginManagement.java
src/main/java/com/keymobile/proxy/api/LoginManagement.java
+1
-1
SecurityConfig.java
src/main/java/com/keymobile/proxy/conf/SecurityConfig.java
+2
-3
AuthService.java
src/main/java/com/keymobile/proxy/service/AuthService.java
+2
-0
CustomUserDetailsService.java
...com/keymobile/proxy/service/CustomUserDetailsService.java
+0
-1
application-test.yml
src/main/resources/application-test.yml
+51
-10
application.yml
src/main/resources/application.yml
+4
-0
No files found.
src/main/java/com/keymobile/proxy/LoginApplication.java
View file @
0f5bff1d
...
@@ -2,8 +2,10 @@ package com.keymobile.proxy;
...
@@ -2,8 +2,10 @@ package com.keymobile.proxy;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
@SpringBootApplication
@SpringBootApplication
@EnableFeignClients
public
class
LoginApplication
{
public
class
LoginApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/keymobile/proxy/api/LoginManagement.java
View file @
0f5bff1d
...
@@ -17,7 +17,7 @@ import java.util.Map;
...
@@ -17,7 +17,7 @@ import java.util.Map;
@RequestMapping
(
value
=
"/"
)
@RequestMapping
(
value
=
"/"
)
public
class
LoginManagement
{
public
class
LoginManagement
{
@RequestMapping
(
value
=
"/sessionInfo"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/sessionInfo"
)
public
@ResponseBody
Map
<
String
,
Object
>
verifyLogin
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
@ResponseBody
Map
<
String
,
Object
>
verifyLogin
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
UserDetails
userDetails
=
(
UserDetails
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
();
UserDetails
userDetails
=
(
UserDetails
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
();
Map
<
String
,
Object
>
rs
=
new
HashMap
<>();
Map
<
String
,
Object
>
rs
=
new
HashMap
<>();
...
...
src/main/java/com/keymobile/proxy/conf/SecurityConfig.java
View file @
0f5bff1d
...
@@ -22,7 +22,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -22,7 +22,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
@Autowired
private
CasProperties
casProperties
;
private
CasProperties
casProperties
;
@
Autowired
@
Override
public
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
public
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
super
.
configure
(
auth
);
super
.
configure
(
auth
);
auth
.
authenticationProvider
(
casAuthenticationProvider
());
auth
.
authenticationProvider
(
casAuthenticationProvider
());
...
@@ -30,8 +30,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -30,8 +30,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
authorizeRequests
().
antMatchers
(
"/api/info/**/*"
).
authenticated
()
http
.
authorizeRequests
()
.
antMatchers
(
"/api/**/*"
).
permitAll
()
.
anyRequest
().
authenticated
();
.
anyRequest
().
authenticated
();
http
.
exceptionHandling
().
authenticationEntryPoint
(
casAuthenticationEntryPoint
()).
and
()
http
.
exceptionHandling
().
authenticationEntryPoint
(
casAuthenticationEntryPoint
()).
and
()
.
addFilter
(
casAuthenticationFilter
());
.
addFilter
(
casAuthenticationFilter
());
...
...
src/main/java/com/keymobile/proxy/service/AuthService.java
View file @
0f5bff1d
...
@@ -5,10 +5,12 @@ import com.keymobile.proxy.model.Domain;
...
@@ -5,10 +5,12 @@ import com.keymobile.proxy.model.Domain;
import
com.keymobile.proxy.model.Role
;
import
com.keymobile.proxy.model.Role
;
import
com.keymobile.proxy.model.User
;
import
com.keymobile.proxy.model.User
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
@Component
@FeignClient
(
value
=
"authService"
)
@FeignClient
(
value
=
"authService"
)
public
interface
AuthService
{
public
interface
AuthService
{
...
...
src/main/java/com/keymobile/proxy/service/CustomUserDetailsService.java
View file @
0f5bff1d
...
@@ -16,7 +16,6 @@ import org.springframework.security.core.userdetails.AuthenticationUserDetailsSe
...
@@ -16,7 +16,6 @@ import org.springframework.security.core.userdetails.AuthenticationUserDetailsSe
import
org.springframework.security.core.userdetails.User
;
import
org.springframework.security.core.userdetails.User
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.util.StringUtils
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
...
src/main/resources/application-test.yml
View file @
0f5bff1d
server
:
server
:
port
:
87
64
port
:
87
77
spring
:
spring
:
application
:
application
:
name
:
auth
name
:
loginService
session
:
session
:
store-type
:
redis
store-type
:
redis
redis
:
redis
:
namespace
:
dataplatform
dev
namespace
:
dataplatform
test
redis
:
redis
:
host
:
localhost
cluster
:
port
:
6379
nodes
:
192.168.0.192:6379
max-redirects
:
6
timeout
:
10000
#客户端超时时间单位是毫秒 默认是2000
maxIdle
:
300
#最大空闲数
maxTotal
:
1000
#控制一个pool可分配多少个jedis实例,用来替换上面的redis.maxActive,如果是jedis 2.4以后用该属性
maxWaitMillis
:
1000
#最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
minEvictableIdleTimeMillis
:
300000
#连接的最小空闲时间 默认1800000毫秒(30分钟)
numTestsPerEvictionRun
:
1024
#每次释放连接的最大数目,默认3
timeBetweenEvictionRunsMillis
:
30000
#逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
testOnBorrow
:
true
#是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个
testWhileIdle
:
true
#在空闲时检查有效性, 默认false
password
:
#密码
jpa
:
hibernate
:
ddl-auto
:
update
datasource
:
datasource
:
url
:
jdbc:mysql://localhost:3306/dataSharing?autoReconnect=true
url
:
jdbc:mysql://dev-vm-00:3306/dev0?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
username
:
root
username
:
test
password
:
dataSharing
password
:
test
hikari
:
maximum-pool-size
:
5
servlet
:
servlet
:
multipart
:
multipart
:
max-file-size
:
100Mb
max-file-size
:
100Mb
...
@@ -22,11 +38,15 @@ spring:
...
@@ -22,11 +38,15 @@ spring:
eureka
:
eureka
:
client
:
client
:
registerWithEureka
:
false
registerWithEureka
:
true
region
:
default
region
:
default
registryFetchIntervalSeconds
:
5
registryFetchIntervalSeconds
:
5
serviceUrl
:
serviceUrl
:
defaultZone
:
http://localhost:8081/eureka/
defaultZone
:
http://192.168.0.213:8081/eureka/
enabled
:
true
instance
:
prefer-ip-address
:
false
hostname
:
192.168.0.128
zuul
:
zuul
:
prefix
:
/api
prefix
:
/api
...
@@ -35,3 +55,23 @@ zuul:
...
@@ -35,3 +55,23 @@ zuul:
logging
:
logging
:
level
:
level
:
org.springframework.security
:
DEBUG
org.springframework.security
:
DEBUG
ribbon
:
ReadTimeout
:
60000
ConnectTimeout
:
60000
redirect-url
:
system-management
:
http://192.168.0.213:8089/views/login.html
security
:
authUser
:
root
authPwd
:
pwd
cas
:
server
:
base-url
:
http://192.168.253.128:8080/cas
paths
:
login
:
http://192.168.253.128:8080/cas/login
service
:
base-url
:
http://192.168.0.213:9090/center-home/view
paths
:
login
:
http://192.168.0.213:9090/center-home/view/main
\ No newline at end of file
src/main/resources/application.yml
0 → 100644
View file @
0f5bff1d
spring
:
profiles
:
active
:
${spring.profiles.active:test}
\ No newline at end of file
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