Skip to content

Commit

Permalink
提交最新代码
Browse files Browse the repository at this point in the history
  • Loading branch information
gmc1987 committed Aug 3, 2019
1 parent f26a5d3 commit 9cdc640
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ spring.mvc.static-path-pattern=/**
#=================================================================
#thymeleaf configure
#=================================================================
spring.thymeleaf.prefix=/pages/
spring.thymeleaf.encoding=utf-8
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.check-template-location=true
spring.thymeleaf.cache=false
#spring.thymeleaf.prefix=/pages/
#spring.thymeleaf.encoding=utf-8
#spring.thymeleaf.suffix=.html
#spring.thymeleaf.mode=LEGACYHTML5
#spring.thymeleaf.check-template-location=true
#spring.thymeleaf.cache=false


#=============================================================
Expand Down Expand Up @@ -71,9 +71,9 @@ spring.datasource.druid.filters=stat, wall
spring.datasource.druid.web-stat-filter.url-pattern=/*
spring.datasource.druid.web-stat-filter.exclusions="*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
spring.datasource.druid.stat-view-servlet.url-pattern=/druid/*
spring.datasource.druid.stat-view-servlet.reset-enable: false
spring.datasource.druid.stat-view-servlet.login-username: sysadmin
spring.datasource.druid.stat-view-servlet.login-password: "000000"
spring.datasource.druid.stat-view-servlet.reset-enable=false
spring.datasource.druid.stat-view-servlet.login-username=sysadmin
spring.datasource.druid.stat-view-servlet.login-password=000000


#=============================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,14 @@ public interface ISideUserService extends ISideBasicService<SideUser>{
*/
public void userEditer(SideUser user) throws Exception;

/**
* 根据SQL查询系统用户
* @param dto 查询实体
* @param pageNumber 当前记录
* @param pageSize 当前页数
* @return
* @throws Exception
*/
public PageMode<SideUser> findSystemUserBySQL(SideUserDto dto, int pageNumber, int pageSize) throws Exception;

}
10 changes: 5 additions & 5 deletions Side-Platform/src/main/java/com/side/users/dto/SideUserDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class SideUserDto implements Serializable {

private Integer account;

private String key;
private String searchKey;

public Long getUserId() {
return userId;
Expand Down Expand Up @@ -64,12 +64,12 @@ public void setAccount(Integer account) {
this.account = account;
}

public String getKey() {
return key;
public String getSearchKey() {
return searchKey;
}

public void setKey(String key) {
this.key = key;
public void setSearchKey(String searchKey) {
this.searchKey = searchKey;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.side.users.dto.SideUserDto;
import com.side.users.pojo.Account;
import com.side.users.pojo.SideUser;
import com.side.users.sql.UserSQL;

/**
* @author gmc
Expand Down Expand Up @@ -76,9 +77,9 @@ public List<SideUser> findAllUser(SideUserDto dto) throws Exception {
criteria.add(Restrictions.eq("userStatus", dto.getUserStatus()));
}

if(!StringUtils.isNullOrEmpty(dto.getKey())) {
criteria.add(Restrictions.or(Restrictions.like("userCode", dto.getKey(), MatchMode.ANYWHERE),
Restrictions.like("userName", dto.getKey(), MatchMode.ANYWHERE)));
if(!StringUtils.isNullOrEmpty(dto.getSearchKey())) {
criteria.add(Restrictions.or(Restrictions.like("userCode", dto.getSearchKey(), MatchMode.ANYWHERE),
Restrictions.like("userName", dto.getSearchKey(), MatchMode.ANYWHERE)));
}

list = sideUserDao.findAll(criteria);
Expand Down Expand Up @@ -107,9 +108,9 @@ public PageMode<SideUser> findUserForPages(SideUserDto dto, int pageNumber, int
criteria.add(Restrictions.eq("userStatus", dto.getUserStatus()));
}

if(!StringUtils.isNullOrEmpty(dto.getKey())) {
criteria.add(Restrictions.or(Restrictions.like("userCode", dto.getKey(), MatchMode.ANYWHERE),
Restrictions.like("userName", dto.getKey(), MatchMode.ANYWHERE)));
if(!StringUtils.isNullOrEmpty(dto.getSearchKey())) {
criteria.add(Restrictions.or(Restrictions.like("userCode", dto.getSearchKey(), MatchMode.ANYWHERE),
Restrictions.like("userName", dto.getSearchKey(), MatchMode.ANYWHERE)));
}

return sideUserDao.findForPage(criteria, pageNumber, pageSize);
Expand Down Expand Up @@ -145,5 +146,13 @@ public void userEditer(SideUser user) throws Exception {

}

@Override
public PageMode<SideUser> findSystemUserBySQL(SideUserDto dto, int pageNumber, int pageSize) throws Exception {

sideUserDao.findBySQL(UserSQL.FIND_SYSTEM_USER_BYSQL, params, pageNumber, pageSize, clazz)

return null;
}


}
17 changes: 17 additions & 0 deletions Side-Platform/src/main/java/com/side/users/sql/UserSQL.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
*
*/
package com.side.users.sql;

/**
* @author gmc
* @see 用户SQL集合
*/
public interface UserSQL {

/**
* 系统用户查询语句
*/
public final static String FIND_SYSTEM_USER_BYSQL = "SELECT a.*, b.roleId FROM side_user a LEFT JOIN side_user_role b ON a.id=b.userId WHERE b.roleId not in (?)";

}
136 changes: 136 additions & 0 deletions Side-Platform/src/main/resources/db/security-schema-postgresql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
Navicat Premium Data Transfer
Source Server : TSSA
Source Server Type : MySQL
Source Server Version : 50723
Source Host : localhost:3306
Source Schema : SIDEDB
Target Server Type : MySQL
Target Server Version : 50723
File Encoding : 65001
Date: 18/07/2019 08:59:55
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for oauth_access_token
-- ----------------------------
DROP TABLE public.oauth_access_token;
CREATE TABLE public.oauth_access_token (
token_id character varying(256) COLLATE pg_catalog."default" NULL,
token oid,
authentication_id character varying(256) COLLATE pg_catalog."default" NOT NULL,
user_name character varying(256) COLLATE pg_catalog."default" NULL,
client_id character varying(256) COLLATE pg_catalog."default" NULL,
authentication oid,
refresh_token character varying(256) COLLATE pg_catalog."default" NULL,
CONSTRAINT oauth_access_token_pkey PRIMARY KEY (authentication_id)
) WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.oauth_access_token
OWNER to postgres;

-- ----------------------------
-- Table structure for oauth_approvals
-- ----------------------------
DROP TABLE public.oauth_approvals;
CREATE TABLE public.oauth_approvals (
userId character varying(128) COLLATE pg_catalog."default" DEFAULT NULL,
clientId character varying(128) COLLATE pg_catalog."default" DEFAULT NULL,
scope character varying(128) COLLATE pg_catalog."default" DEFAULT NULL,
status character varying(10) COLLATE pg_catalog."default" DEFAULT NULL,
expiresAt timestamp NOT NULL DEFAULT (now()),
lastModifiedAt timestamp NULL DEFAULT NULL
) WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.oauth_approvals
OWNER to postgres;

-- ----------------------------
-- Table structure for oauth_client_details
-- ----------------------------
DROP TABLE public.oauth_client_details;
CREATE TABLE public.oauth_client_details (
client_id character varying(256) COLLATE pg_catalog."default" NOT NULL,
resource_ids character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
client_secret character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
scope character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
authorized_grant_types character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
web_server_redirect_uri character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
authorities character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
access_token_validity bigint DEFAULT NULL,
refresh_token_validity bigint DEFAULT NULL,
additional_information character varying(4096) COLLATE pg_catalog."default" DEFAULT NULL,
autoapprove character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
CONSTRAINT oauth_client_details_pkey PRIMARY KEY (client_id)
) WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.oauth_client_details
OWNER to postgres;

-- ----------------------------
-- Table structure for oauth_client_token
-- ----------------------------
DROP TABLE public.oauth_client_token;
CREATE TABLE public.oauth_client_token (
token_id character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
token oid,
authentication_id character varying(256) COLLATE pg_catalog."default" NOT NULL,
user_name character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
client_id character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
CONSTRAINT oauth_client_token_pkey PRIMARY KEY (authentication_id)
) WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.oauth_client_token
OWNER to postgres;

-- ----------------------------
-- Table structure for oauth_code
-- ----------------------------
DROP TABLE public.oauth_code;
CREATE TABLE public.oauth_code (
code character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
authentication oid
) WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.oauth_code
OWNER to postgres;

-- ----------------------------
-- Table structure for oauth_refresh_token
-- ----------------------------
DROP TABLE public.oauth_refresh_token;
CREATE TABLE public.oauth_refresh_token (
token_id character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
token oid,
authentication oid
) WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.oauth_refresh_token
OWNER to postgres;


SET FOREIGN_KEY_CHECKS = 1;
13 changes: 7 additions & 6 deletions Side-Platform/src/test/java/com/side/MD5Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
*/
package com.side;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import com.side.basic.common.utils.UtilMD5;
import java.util.ArrayList;
import java.util.List;

/**
* @author gmc
Expand All @@ -19,9 +18,11 @@ public class MD5Test {
public static void main(String[] args) {
// TODO Auto-generated method stub

BCryptPasswordEncoder encode = new BCryptPasswordEncoder();

System.out.println("加密后:" + encode.encode("123456"));
List<String> list = new ArrayList<String>();
for(int i = 0; i < 5; i++) {
list.add(String.valueOf(i));
}
System.out.println(list.toString().replace("[", "").replace("]", ""));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ private RequestMatcher csrfRequestMatcher() {
private final Pattern allowedMethods = Pattern.compile("^(GET|HEAD|OPTIONS|TRACE|POST)$");

// Disable CSFR protection on the following urls:
private final AntPathRequestMatcher[] requestMatchers = { new AntPathRequestMatcher("/auth-center/**"), new AntPathRequestMatcher("/side/**") };
private final AntPathRequestMatcher[] requestMatchers = { new AntPathRequestMatcher("/auth-center/**"),
new AntPathRequestMatcher("/side/**") };

@Override
public boolean matches(HttpServletRequest request) {
Expand Down
28 changes: 7 additions & 21 deletions Side-Zuul/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,41 @@ spring.aop.proxy-target-class=true


eureka.instance.prefer-ip-address=true
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
#eureka.client.register-with-eureka=true
#eureka.client.fetch-registry=true
eureka.client.service-url.defaultZone=http://service-register-server1:8000/eureka,http://service-register-server2:8001/eureka

zuul.host.connect-timeout-millis=60000
zuul.host.socket-timeout-millis=60000
ribbon.ReadTimeout=50000
ribbon.ConnectTimeout=50000


##\u89E3\u51B3\u8DE8\u57DF\u95EE\u9898
#zuul.sensitive-headers=Access-Control-Allow-Origin
#zuul.ignored-headers=Access-Control-Allow-Origin,H-APP-Id,Token,APPToken

#zuul.sensitive-headers='Access-Control-Allow-Origin'
zuul.ignored-services='*'
#zuul.ignored-services=test
#zuul.prefix=/api
#fail to retry
zuul.retryable=true
#zuul.ignore-security-headers=false
#zuul.add-host-header=true
#ribbon.eureka.enabled=false
#ribbon.eureka.enabled=true
zuul.add-proxy-headers=true

#management.endpoints.web.exposure.include='*'

management.endpoints.web.exposure.include='*'
management.endpoint.health.show-details=always

zuul.routes.auth-center.path=/auth-center/**
zuul.routes.auth-center.service-id=auth-center
zuul.routes.auth-center.sensitive-headers=
zuul.routes.auth-center.strip-prefix=false


zuul.routes.side.path=/side/**
zuul.routes.side.service-id=side
zuul.routes.side.sensitive-headers=
zuul.routes.side.strip-prefix=false
#zuul.routes.side.sensitive-headers=Cookie,Set-Cookie,Authorization



#spring.security.user.name=user
#spring.security.user.password=123456


security.oauth2.sso.login-path=http://localhost:8080/
#security.oauth2.client.access-token-uri=http://localhost:8801/auth-center/oauth/token
#security.oauth2.client.user-authorization-uri=/auth-center/oauth/authorize

#security.oauth2.sso.login-path=http://localhost:8801/login
security.oauth2.client.access-token-uri=http://localhost:8801/auth-center/oauth/token
security.oauth2.client.user-authorization-uri=http://localhost:8801/auth-center/oauth/authorize

Expand Down
Loading

0 comments on commit 9cdc640

Please sign in to comment.