Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1.x #7

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hk-quartz-ms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.hk.oauth2.server.config;

import com.hk.commons.JsonResult;
import com.hk.core.authentication.oauth2.exception.Oauth2DefaultWebResponseExceptionTranslator;
import com.hk.core.web.Webs;
import com.hk.oauth2.TokenRegistry;
import com.hk.oauth2.exception.Oauth2DefaultWebResponseExceptionTranslator;
import com.hk.oauth2.provider.ClientDetailsCheckService;
import com.hk.oauth2.provider.code.RedisAuthorizationCodeServices;
import com.hk.oauth2.provider.token.CompositeAuthenticationKeyGenerator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hk.oauth2.server.service.impl;

import com.hk.commons.util.ByteConstants;
import com.hk.oauth2.exception.Oauth2ClientStatusException;
import com.hk.core.authentication.oauth2.exception.Oauth2ClientStatusException;
import com.hk.oauth2.provider.ClientDetailsCheckService;
import com.hk.oauth2.server.entity.Oauth2ClientDetails;
import com.hk.oauth2.server.service.Oauth2ClientDetailsService;
Expand Down
166 changes: 166 additions & 0 deletions src/main/config/hk-pms-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
server:
servlet:
context-path: /
session:
cookie:
name: pms_jsession
http-only: true
spring:
servlet:
multipart:
enabled: false # 禁用文件上传功能
mvc:
throw-exception-if-no-handler-found: true
resources:
add-mappings: true
messages:
basename: org/springframework/security/messages,com/hk/core/i18n/messages,messages
encoding: utf-8
cache-duration: -1ms
# jpa:
# show-sql: true
# generate-ddl: false
# properties:
# hibernate:
# # hbm2ddl:
# # auto: upload
# # 解决懒加载在非事务中的 no-session 的问题 @see https://stackoverflow.com/questions/36583185/spring-data-jpa-could-not-initialize-proxy-no-session-with-methods-marke
# enable_lazy_load_no_trans: true
# dialect: org.hibernate.dialect.PostgreSQL95Dialect

datasource:
name: druid
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.64.128:3306/hk_pms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true
username: root
password: root
druid:
initial-size: 1
max-active: 20
min-idle: 1
max-wait: 6000
time-between-eviction-runs-millis: 60000
test-on-borrow: true
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
filters: stat,wall,log4j2
filter:
stat:
slow-sql-millis: 5000
connection-properties: druid.stat.mergeSql=true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
# 禁用HTML页面上的“Reset All”功能
reset-enable: false
allow: 127.0.0.1
login-username: druidAdmin
login-password: druidAdmin@%*
web-stat-filter:
enabled: true
url-pattern: /**
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"

################################################################### redis
cache:
type: redis
redis:
host: 192.168.64.150
password: 1234567
port: 6379
database: 2
timeout: 3000ms
lettuce:
pool:
max-active: 8
min-idle: 0
max-idle: 8
max-wait: -1ms

################################################################### eureka
eureka:
instance:
prefer-ip-address: false
hostname: 127.0.0.1
client:
service-url:
defaultZone: http://root:[email protected]:8761/eureka
######################################################### mybatis 配置
mybatis:
mapper-locations: classpath:mybatis/mappers/*.xml
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.log4j2.Log4j2Impl

######################################################### mybatis pageHelper 配置
pagehelper:
reasonable: false
support-methods-arguments: true
params: count=countSql

################################################################### security oauth2
# 特别注意:
# 1.这里配置的url如果是 127.0.0.1,登陆成功后访问sso 认证服务器时也只能以这个ip地址访问,不能用 localhost,
# 除非你配置的是localhost,否则,在访问认证服务器的时候,sso会让你重新登陆,具体原因未查明,但经过测试结果是这样的
# 这句话的意思就是:
# 如下面的 access-token-url 和 user-authorization-uri 配置的ip 是127.0.0.1,
# 在登陆成功后,也只能是 http://127.0.0.1:8080来访问认证服务器,如果用 http://localhost:8080来访问认证服务器, 认证服务器会让你登陆。
# 2. 以本项目中的 pms 与 emi 举例,如果 pms 中配置的是 127.0.0.1 ,而 emi 中配置的是 localhost,
# 如果 pms通过认证, 在访问emi时,也需要再登陆一次,即不会实现单点,
# 通过浏览器查看cookie可知,使用 127.0.0.1 和 localhost 访问的时候, 浏览器带上的cookie信息是不一样的
security:
oauth2:
client:
client-id: 7872c6f7f0cb41f0ba0f8aa060cb5c37
client-secret: 7872c6f7f0cb41f0ba0f8aa060cb5c37
# 不知道为什么,如果配置成gateway 的url (http://127.0.0.1:8771/oauth2/oauth/token) 会有传递的参数丢失的问题
access-token-uri: http://127.0.0.1:8086/oauth/token
user-authorization-uri: http://127.0.0.1:8086/oauth/authorize
# use-current-uri: false
# pre-established-redirect-uri: http://127.0.0.1:8771/pms/login
resource:
jwt:
key-uri: http://127.0.0.1:8086/oauth/token_key
sso:
login-path: /login

hk:
authentication:
browser:
logout-url: /logout
logout-success-url: http://127.0.0.1:8771/oauth2/logout?redirect_url=http://127.0.0.1:8771/pms/index
gate-way-host: http://127.0.0.1:8771/pms
# permit-all-matchers:
# - method: GET
# uris:
# - /api/**
# permission: admin
# - method: GET
# uris:
# - /aaaa/**
# permission: admin
default-failure-url: http://127.0.0.1:8771/pms/error #使用了gateway这里写上gateway访问的路径,如果是前后端分离项目,可以不需要这样写
######################################################### swagger 文档生成配置
swagger:
title: "XXX公司_统一用户管理系统_接口文档"
description: "用户管理系统..."
version: "2.0.2.RELEASE"
base-package: "com.hk.pms.controller"
######################################################### logging 配置
logging:
level:
root: error
com.hk: debug
org.springframework.security: debug
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: debug
org.springframework.jdbc.core.JdbcTemplate: debug
org.springframework.jdbc.core.StatementCreatorUtils: trace
# org.hibernate.SQL: debug
# org.hibernate.type.descriptor.sql.BasicBinder: debug





181 changes: 181 additions & 0 deletions src/main/config/hk-sso-server-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
server:
servlet:
context-path: /
session:
cookie:
name: auth_jsession
http-only: true
##########################################################
spring:
servlet:
multipart:
enabled: false # 禁用文件上传功能
mvc:
throw-exception-if-no-handler-found: true
######################################################### 国际化配置
messages:
encoding: UTF-8
basename: org/springframework/security/messages,com/hk/core/i18n/messages,messages
cache-duration: -1ms
######################################################### thymeleaf 配置
thymeleaf:
enabled: true
cache: false
mode: HTML5
encoding: UTF-8
prefix: classpath:/templates/
suffix: .html
servlet:
content-type: text/html; charset=utf-8
########################################################## jpa 配置
# jpa:
# show-sql: true
# generate-ddl: false
# properties:
# hibernate:
# # hbm2ddl:
# # auto: upload
# enable_lazy_load_no_trans: true # 解决懒加载在非事务中的 no-session 的问题 @see https://stackoverflow.com/questions/36583185/spring-data-jpa-could-not-initialize-proxy-no-session-with-methods-marke
# dialect: org.hibernate.dialect.MySQL57InnoDBDialect
######################################################### datasource 配置
datasource:
name: druid
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.64.128:3306/hk_pms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true
username: root
password: root
druid:
initial-size: 1
max-active: 20
min-idle: 1
max-wait: 6000
time-between-eviction-runs-millis: 60000
test-on-borrow: true
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
filters: stat,wall,log4j2
filter:
stat:
slow-sql-millis: 5000
connection-properties: druid.stat.mergeSql=true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
# 禁用HTML页面上的“Reset All”功能
reset-enable: false
allow: 127.0.0.1
login-username: druidAdmin
login-password: druidAdmin@%*
web-stat-filter:
enabled: true
url-pattern: /**
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
################################################################### redis
cache:
type: redis
redis:
password: 1234567
<<<<<<< HEAD
host: 127.0.0.1
=======
host: 192.168.64.150
>>>>>>> remotes/origin/2.0.5.RELEASE
port: 6379
database: 2
timeout: 3000ms
lettuce:
pool:
max-active: 8
min-idle: 0
max-idle: 8
max-wait: -1ms
######################################################### eureka 配置
eureka:
instance:
hostname: 127.0.0.1
prefer-ip-address: false
client:
service-url:
defaultZone: http://root:[email protected]:8761/eureka

######################################################### mybatis 配置
mybatis:
mapper-locations: classpath:mybatis/mappers/*.xml
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.log4j2.Log4j2Impl

######################################################### mybatis pageHelper 配置
pagehelper:
reasonable: false
support-methods-arguments: true
params: count=countSql

######################################################### spring security oauth2 配置
security:
oauth2:
authorization:
token-key-access: "isAuthenticated()"
check-token-access: "isAuthenticated()"

hk:
authentication:
browser:
login-url: /login
login-processing-url: /login
logout-url: /logout
logout-success-url: /
username-parameter: username
password-parameter: password
maximum-sessions: 2
sms:
enabled: true
code-length: 6
code-expire-in: 180
code-parameter: phoneCode
phone-parameter: phone
post-only: true
phone-login-uri: /mobile/login

######################################################### 微信配置
wechat:
mp:
app-id: wx72303d4d8b1f0d00 #微信网页二维码登陆需要在微信开放平台申请账号并审核,公众平台的app-id无效
secret: 19175e5d7111969a1dcc86048d338f866
# token: hk9060 #此token对于微信网页二微码登陆无效
qrcode:
callback-url: /wechat/callback
call-host: http://sqn62q.natappfree.cc
state: 3d6be0a4685d839573b04816624a415e


######################################################### logging 配置
logging:
level:
root: error
com.hk: debug
org.springframework.web.socket: debug
org.springframework.cloud.stream: debug
# org.springframework.security: debug
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: debug
org.springframework.jdbc.core.JdbcTemplate: debug
<<<<<<< HEAD
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate: debug
org.springframework.jdbc.core.StatementCreatorUtils: debug
org.hibernate.SQL: debug
org.hibernate.type.descriptor.sql.BasicBinder: debug
com.hk: debug







=======
org.springframework.jdbc.core.StatementCreatorUtils: trace
# org.hibernate.SQL: debug
# org.hibernate.type.descriptor.sql.BasicBinder: debug
>>>>>>> remotes/origin/2.0.5.RELEASE