Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
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
openSource
apollo
Commits
bfba1d30
Commit
bfba1d30
authored
Sep 11, 2017
by
Jason Song
Committed by
GitHub
Sep 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into huming
parents
8e80f879
2b49ae56
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
15 deletions
+26
-15
AuthConfiguration.java
...rk/apollo/portal/spi/configuration/AuthConfiguration.java
+12
-2
apolloportaldb.sql
scripts/sql-docker/apolloportaldb.sql
+5
-5
apolloportaldb.sql
scripts/sql/apolloportaldb.sql
+5
-5
apolloportaldb-v080-v090.sql
scripts/sql/delta/v080-v090/apolloportaldb-v080-v090.sql
+4
-3
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
View file @
bfba1d30
...
...
@@ -211,10 +211,20 @@ public class AuthConfiguration {
@Bean
public
JdbcUserDetailsManager
jdbcUserDetailsManager
(
AuthenticationManagerBuilder
auth
,
DataSource
datasource
)
throws
Exception
{
return
auth
.
jdbcAuthentication
().
passwordEncoder
(
new
BCryptPasswordEncoder
()).
dataSource
(
datasource
)
.
usersByUsernameQuery
(
"select Username,Password,Enabled from `Users` where Username
=
?"
)
JdbcUserDetailsManager
jdbcUserDetailsManager
=
auth
.
jdbcAuthentication
().
passwordEncoder
(
new
BCryptPasswordEncoder
()).
dataSource
(
datasource
)
.
usersByUsernameQuery
(
"select Username,Password,Enabled from `Users` where Username
=
?"
)
.
authoritiesByUsernameQuery
(
"select Username,Authority from `Authorities` where Username = ?"
)
.
getUserDetailsService
();
jdbcUserDetailsManager
.
setUserExistsSql
(
"select Username from `Users` where Username = ?"
);
jdbcUserDetailsManager
.
setCreateUserSql
(
"insert into `Users` (Username, Password, Enabled) values (?,?,?)"
);
jdbcUserDetailsManager
.
setUpdateUserSql
(
"update `Users` set Password = ?, Enabled = ? where Username = ?"
);
jdbcUserDetailsManager
.
setDeleteUserSql
(
"delete from `Users` where Username = ?"
);
jdbcUserDetailsManager
.
setCreateAuthoritySql
(
"insert into `Authorities` (Username, Authority) values (?,?)"
);
jdbcUserDetailsManager
.
setDeleteUserAuthoritiesSql
(
"delete from `Authorities` where Username = ?"
);
jdbcUserDetailsManager
.
setChangePasswordSql
(
"update `Users` set Password = ? where Username = ?"
);
return
jdbcUserDetailsManager
;
}
@Bean
...
...
scripts/sql-docker/apolloportaldb.sql
View file @
bfba1d30
...
...
@@ -27,7 +27,7 @@ CREATE TABLE `App` (
`OwnerEmail`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerEmail'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -78,7 +78,7 @@ CREATE TABLE `Consumer` (
`OwnerEmail`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerEmail'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -141,7 +141,7 @@ CREATE TABLE `ConsumerToken` (
`Expires`
datetime
NOT
NULL
DEFAULT
'2099-01-01 00:00:00'
COMMENT
'token失效时间'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -161,7 +161,7 @@ CREATE TABLE `Favorite` (
`Position`
int
(
32
)
NOT
NULL
DEFAULT
'10000'
COMMENT
'收藏顺序'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -288,7 +288,7 @@ CREATE TABLE `Users` (
`Email`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'邮箱地址'
,
`Enabled`
tinyint
(
4
)
DEFAULT
NULL
COMMENT
'是否有效'
,
PRIMARY
KEY
(
`Id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COMMENT
=
'用户表'
;
#
Dump
of
table
Authorities
...
...
scripts/sql/apolloportaldb.sql
View file @
bfba1d30
...
...
@@ -27,7 +27,7 @@ CREATE TABLE `App` (
`OwnerEmail`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerEmail'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -78,7 +78,7 @@ CREATE TABLE `Consumer` (
`OwnerEmail`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerEmail'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -141,7 +141,7 @@ CREATE TABLE `ConsumerToken` (
`Expires`
datetime
NOT
NULL
DEFAULT
'2099-01-01 00:00:00'
COMMENT
'token失效时间'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -161,7 +161,7 @@ CREATE TABLE `Favorite` (
`Position`
int
(
32
)
NOT
NULL
DEFAULT
'10000'
COMMENT
'收藏顺序'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
...
...
@@ -287,7 +287,7 @@ CREATE TABLE `Users` (
`Email`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'邮箱地址'
,
`Enabled`
tinyint
(
4
)
DEFAULT
NULL
COMMENT
'是否有效'
,
PRIMARY
KEY
(
`Id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COMMENT
=
'用户表'
;
#
Dump
of
table
Authorities
...
...
scripts/sql/delta/v080-v090/apolloportaldb-v080-v090.sql
View file @
bfba1d30
...
...
@@ -6,9 +6,10 @@ CREATE TABLE `Users` (
`Id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`Username`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'用户名'
,
`Password`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'密码'
,
`Email`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'邮箱地址'
,
`Enabled`
tinyint
(
4
)
DEFAULT
NULL
COMMENT
'是否有效'
,
PRIMARY
KEY
(
`Id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COMMENT
=
'用户表'
;
CREATE
TABLE
`Authorities`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
...
...
@@ -17,8 +18,8 @@ CREATE TABLE `Authorities` (
PRIMARY
KEY
(
`Id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
INSERT
INTO
`Users`
(
`Username`
,
`Password`
,
`Enabled`
)
INSERT
INTO
`Users`
(
`Username`
,
`Password`
,
`E
mail`
,
`E
nabled`
)
VALUES
(
'apollo'
,
'$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS'
,
1
);
(
'apollo'
,
'$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS'
,
'apollo@acme.com'
,
1
);
INSERT
INTO
`Authorities`
(
`Username`
,
`Authority`
)
VALUES
(
'apollo'
,
'ROLE_user'
);
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