Skip to content

Commit

Permalink
多属性多条返回
Browse files Browse the repository at this point in the history
  • Loading branch information
kawhii committed Nov 6, 2017
1 parent 08f9a9d commit 80bd3a6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
25 changes: 24 additions & 1 deletion sso-config/src/main/resources/config/sso-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ cas.authn.pm.jdbc.autocommit=true


## \u591A\u5C5E\u6027\u8FD4\u56DE\u5F00\u59CB

###\u5355\u884C
cas.authn.attributeRepository.jdbc[0].attributes.id=id
cas.authn.attributeRepository.jdbc[0].attributes.email=email
cas.authn.attributeRepository.jdbc[0].attributes.address=address
Expand All @@ -334,6 +336,7 @@ cas.authn.attributeRepository.jdbc[0].order=0
cas.authn.attributeRepository.jdbc[0].url=${cas.authn.jdbc.query[0].url}
# \u4EE5\u4E0B\u5C5E\u6027\u4E3A\u67E5\u8BE2sql\u65F6\uFF0C\u5F53\u4E3A\u591A\u4E2A\u65F6\u9017\u53F7\u5206\u9694\uFF0C\u5982\u586B\u5199username\u3001email,sql\u4F1A\u53D8\u6210 select * from sys_user where username=${?} {and/or} email=${?}
cas.authn.attributeRepository.jdbc[0].username=username,email
cas.authn.attributeRepository.jdbc[0].queryType=OR
cas.authn.attributeRepository.jdbc[0].user=${cas.authn.jdbc.query[0].user}
cas.authn.attributeRepository.jdbc[0].password=${cas.authn.jdbc.query[0].password}
cas.authn.attributeRepository.jdbc[0].sql=select * from sys_user where {0}
Expand All @@ -343,6 +346,26 @@ cas.authn.attributeRepository.jdbc[0].driverClass=${cas.authn.jdbc.query[0].driv
cas.authn.attributeRepository.jdbc[0].leakThreshold=10
cas.authn.attributeRepository.jdbc[0].propagationBehaviorName=PROPAGATION_REQUIRED
cas.authn.attributeRepository.jdbc[0].batchSize=1
cas.authn.attributeRepository.jdbc[0].healthQuery=SELECT 1
cas.authn.attributeRepository.jdbc[0].failFast=true


#\u591A\u884C
cas.authn.attributeRepository.jdbc[1].attributes.group=group_multi
cas.authn.attributeRepository.jdbc[1].attributes.school=school_multi
#\u952E\u503C\u5BF9
cas.authn.attributeRepository.jdbc[1].columnMappings.ATTR_KEY=ATTR_VAL
cas.authn.attributeRepository.jdbc[1].singleRow=false
cas.authn.attributeRepository.jdbc[1].order=1
cas.authn.attributeRepository.jdbc[1].url=${cas.authn.jdbc.query[0].url}
cas.authn.attributeRepository.jdbc[1].username=username
cas.authn.attributeRepository.jdbc[1].user=${cas.authn.jdbc.query[0].user}
cas.authn.attributeRepository.jdbc[1].password=${cas.authn.jdbc.query[0].password}
cas.authn.attributeRepository.jdbc[1].sql=select * from sys_attrs where {0}
cas.authn.attributeRepository.jdbc[1].dialect=${cas.authn.jdbc.query[0].dialect}
cas.authn.attributeRepository.jdbc[1].ddlAuto=none
cas.authn.attributeRepository.jdbc[1].driverClass=${cas.authn.jdbc.query[0].driverClass}
cas.authn.attributeRepository.jdbc[1].leakThreshold=10
cas.authn.attributeRepository.jdbc[1].propagationBehaviorName=PROPAGATION_REQUIRED
cas.authn.attributeRepository.jdbc[1].batchSize=1
cas.authn.attributeRepository.jdbc[1].failFast=true
## \u591A\u5C5E\u6027\u8FD4\u56DE\u7ED3\u675F
9 changes: 9 additions & 0 deletions sso-server/src/main/resources/profile/dev/sql/data-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ INSERT INTO SYS_USER_QUESTION VALUES ('admin', '使用过的密码是?', '123
INSERT INTO SYS_USER_QUESTION VALUES ('admin', '你的年龄是?', '24');
INSERT INTO SYS_USER_QUESTION VALUES ('zhangsan', '我的名字是?', 'zhangsan');
INSERT INTO SYS_USER_QUESTION VALUES ('zhangsan', '我在哪里工作?', 'guangzhou');


---用户属性表
INSERT INTO SYS_ATTRS VALUES ('admin', 'group', 'ADMIN_ROLE');
INSERT INTO SYS_ATTRS VALUES ('admin', 'group', 'MANAGEMENT_ROLE');
INSERT INTO SYS_ATTRS VALUES ('admin', 'group', 'DEV_ROLE');
INSERT INTO SYS_ATTRS VALUES ('admin', 'school', 'GuangZhou');
INSERT INTO SYS_ATTRS VALUES ('admin', 'school', 'ZhuHai');
INSERT INTO SYS_ATTRS VALUES ('zhangsan', 'group', 'DEV_ROLE');
9 changes: 9 additions & 0 deletions sso-server/src/main/resources/profile/dev/sql/schema-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@ CREATE TABLE SYS_USER_QUESTION (
USERNAME VARCHAR(30) NOT NULL,
QUESTION VARCHAR(200) NOT NULL,
ANSWER VARCHAR(100) NOT NULL
);

/*
* 用户属性表
*/
CREATE TABLE SYS_ATTRS (
USERNAME VARCHAR(30) NOT NULL,
ATTR_KEY VARCHAR(50) NOT NULL,
ATTR_VAL VARCHAR(100) NOT NULL
);

0 comments on commit 80bd3a6

Please sign in to comment.