Skip to content

Commit 29b25f8

Browse files
authored
Merge pull request #3 from monkeyk/3.0.0
import v3.0.0 codes merge master
2 parents 2c9b35f + 16605dc commit 29b25f8

File tree

141 files changed

+9171
-2688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+9171
-2688
lines changed

.gitignore

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
*.class
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
23

3-
# Mobile Tools for Java (J2ME)
4-
.mtj.tmp/
4+
### STS ###
5+
.apt_generated
6+
.classpath
7+
.factorypath
8+
.project
9+
.settings
10+
.springBeans
511

6-
# Package Files #
7-
*.jar
8-
*.war
9-
*.ear
12+
### IntelliJ IDEA ###
13+
.idea
14+
*.iws
15+
*.iml
16+
*.ipr
1017

11-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12-
hs_err_pid*
18+
### NetBeans ###
19+
nbproject/private/
20+
build/
21+
nbbuild/
22+
dist/
23+
nbdist/
24+
.nb-gradle/

LICENSE

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GNU GENERAL PUBLIC LICENSE
22
Version 2, June 1991
33

4-
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
4+
Copyright (C) 1989, 1991 Free Software Foundation, Inc., [http://fsf.org/]
55
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
66
Everyone is permitted to copy and distribute verbatim copies
77
of this license document, but changing it is not allowed.
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
291291
the "copyright" line and a pointer to where the full notice is found.
292292

293293
{description}
294-
Copyright (C) {year} {fullname}
294+
Copyright (C) 2013 li.shengzhao
295295

296296
This program is free software; you can redistribute it and/or modify
297297
it under the terms of the GNU General Public License as published by
@@ -336,5 +336,4 @@ This General Public License does not permit incorporating your program into
336336
proprietary programs. If your program is a subroutine library, you may
337337
consider it more useful to permit linking proprietary applications with the
338338
library. If this is what you want to do, use the GNU Lesser General
339-
Public License instead of this License.
340-
339+
Public License instead of this License.

README.md

Lines changed: 507 additions & 60 deletions
Large diffs are not rendered by default.
-2.19 MB
Binary file not shown.
-49.8 KB
Binary file not shown.

others/database/initial_data.ddl

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,57 @@
22

33
truncate user_;
44
truncate user_privilege;
5-
-- admin, password is admin ( All privileges)
6-
insert into user_(id,guid,create_time,email,password,phone,username,default_user)
7-
values
8-
(21,'29f6004fb1b0466f9572b02bf2ac1be8',now(),'[email protected]','$2a$10$XWN7zOvSLDiyxQnX01KMXuf5NTkkuAUtt23YxUMWaIPURcR7bdULi','028-1234567','admin',1);
5+
-- admin, password is Admin@2013 ( All privileges)
6+
insert into user_(id, guid, create_time, email, password, phone, username, default_user)
7+
values (21, '29f6004fb1b0466f9572b02bf2ac1be8', now(), '[email protected]',
8+
'$2a$10$bIIt6KqIMweTZZC.IIHBLuN3dEIJL0LQFRPrtWTujn9O3Sl5Us5vW', '028-1234567', 'admin', 1);
99

10-
insert into user_privilege(user_id,privilege) values (21,'ADMIN');
11-
insert into user_privilege(user_id,privilege) values (21,'UNITY');
12-
insert into user_privilege(user_id,privilege) values (21,'MOBILE');
10+
insert into user_privilege(user_id, privilege)
11+
values (21, 'ADMIN');
12+
insert into user_privilege(user_id, privilege)
13+
values (21, 'UNITY');
14+
insert into user_privilege(user_id, privilege)
15+
values (21, 'MOBILE');
1316

14-
-- unity, password is unity ( ROLE_UNITY)
15-
insert into user_(id,guid,create_time,email,password,phone,username,default_user)
16-
values
17-
(22,'55b713df1c6f423e842ad68668523c49',now(),'[email protected]','$2a$10$gq3eUch/h.eHt20LpboSXeeZinzSLBk49K5KD.Ms4/1tOAJIsrrfq','','unity',0);
17+
-- unity, password is Unity#2013 ( ROLE_UNITY)
18+
insert into user_(id, guid, create_time, email, password, phone, username, default_user)
19+
values (22, '55b713df1c6f423e842ad68668523c49', now(), '[email protected]',
20+
'$2a$10$M/bdEKNH12ksSmMgt0p3YeSjW4C5auAjE8by9BY6oEkHTjGKNDqTO', '', 'unity', 0);
1821

19-
insert into user_privilege(user_id,privilege) values (22,'UNITY');
22+
insert into user_privilege(user_id, privilege)
23+
values (22, 'UNITY');
2024

21-
-- mobile, password is mobile ( ROLE_MOBILE)
22-
insert into user_(id,guid,create_time,email,password,phone,username,default_user)
23-
values
24-
(23,'612025cb3f964a64a48bbdf77e53c2c1',now(),'[email protected]','$2a$10$BOmMzLDaoiIQ4Q1pCw6Z4u0gzL01B8bNL.0WUecJ2YxTtHVRIA8Zm','','mobile',0);
25+
-- mobile, password is Mobile*2013 ( ROLE_MOBILE)
26+
insert into user_(id, guid, create_time, email, password, phone, username, default_user)
27+
values (23, '612025cb3f964a64a48bbdf77e53c2c1', now(), '[email protected]',
28+
'$2a$10$MJKW44F.e.UH.54OY36b6eCPpp8KRszL3vAgqLyL1WWnpbGp7A8zW', '', 'mobile', 0);
2529

26-
insert into user_privilege(user_id,privilege) values (23,'MOBILE');
30+
insert into user_privilege(user_id, privilege)
31+
values (23, 'MOBILE');
2732

2833

2934
-- initial oauth client details test data
30-
-- 'unity-client' support browser, js(flash) visit, secret: unity
35+
-- 'unity-client' support browser device visit, secret: unity
3136
-- 'mobile-client' only support mobile-device visit, secret: mobile
32-
truncate oauth_client_details;
33-
insert into oauth_client_details
34-
(client_id, resource_ids, client_secret, scope, authorized_grant_types,
35-
web_server_redirect_uri,authorities, access_token_validity,
36-
refresh_token_validity, additional_information, create_time, archived, trusted)
37-
values
38-
('unity-client','sos-resource', '$2a$10$QQTKDdNfj9sPjak6c8oWaumvTsa10MxOBOV6BW3DvLWU6VrjDfDam', 'read','authorization_code,refresh_token,implicit',
39-
'http://localhost:8080/spring-oauth-server/unity/dashboard','ROLE_CLIENT',null,
40-
null,null, now(), 0, 0),
41-
('mobile-client','sos-resource', '$2a$10$uLvpxfvm3CuUyjIvYq7a9OUmd9b3tHFKrUaMyU/jC01thrTdkBDVm', 'read','password,refresh_token',
42-
null,'ROLE_CLIENT',null,
43-
null,null, now(), 0, 0);
37+
truncate oauth2_registered_client;
38+
insert into oauth2_registered_client
39+
(id, create_time, client_id, client_secret, client_name, client_authentication_methods,
40+
authorization_grant_types, redirect_uris, post_logout_redirect_uris, scopes, client_settings, token_settings)
41+
values ('851eee5eaba94b0cacca53a3ef543423', now(), 'unity-client',
42+
'$2a$10$QQTKDdNfj9sPjak6c8oWaumvTsa10MxOBOV6BW3DvLWU6VrjDfDam',
43+
'Unity-Client',
44+
'client_secret_post,client_secret_jwt,client_secret_basic',
45+
'refresh_token,urn:ietf:params:oauth:grant-type:device_code,authorization_code',
46+
'http://localhost:8080/unity/dashboard', null, 'openid,profile,email',
47+
'{"@class":"java.util.Collections$UnmodifiableMap","settings.client.require-proof-key":true,"settings.client.require-authorization-consent":true}',
48+
'{"@class":"java.util.Collections$UnmodifiableMap","settings.token.reuse-refresh-tokens":true,"settings.token.id-token-signature-algorithm":["org.springframework.security.oauth2.jose.jws.SignatureAlgorithm","ES256"],"settings.token.access-token-time-to-live":["java.time.Duration",7200.000000000],"settings.token.access-token-format":{"@class":"org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat","value":"self-contained"},"settings.token.refresh-token-time-to-live":["java.time.Duration",172800.000000000],"settings.token.authorization-code-time-to-live":["java.time.Duration",120.000000000],"settings.token.device-code-time-to-live":["java.time.Duration",300.000000000]}'),
49+
('aedd67f6dae441b99e3a0fb27889ce12', now(), 'mobile-client',
50+
'$2a$10$uLvpxfvm3CuUyjIvYq7a9OUmd9b3tHFKrUaMyU/jC01thrTdkBDVm',
51+
'Mobile-Client',
52+
'client_secret_post,client_secret_basic',
53+
'refresh_token,password',
54+
null, null, 'openid,profile',
55+
'{"@class":"java.util.Collections$UnmodifiableMap","settings.client.require-proof-key":true,"settings.client.require-authorization-consent":true}',
56+
'{"@class":"java.util.Collections$UnmodifiableMap","settings.token.reuse-refresh-tokens":true,"settings.token.id-token-signature-algorithm":["org.springframework.security.oauth2.jose.jws.SignatureAlgorithm","ES256"],"settings.token.access-token-time-to-live":["java.time.Duration",7200.000000000],"settings.token.access-token-format":{"@class":"org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat","value":"self-contained"},"settings.token.refresh-token-time-to-live":["java.time.Duration",172800.000000000],"settings.token.authorization-code-time-to-live":["java.time.Duration",120.000000000],"settings.token.device-code-time-to-live":["java.time.Duration",300.000000000]}');
57+
58+

others/database/initial_db.ddl

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,40 @@
1212
-- ###############
1313
-- Domain: User
1414
-- ###############
15-
Drop table if exists user_;
16-
CREATE TABLE user_ (
17-
id int(11) NOT NULL auto_increment,
18-
guid varchar(255) not null unique,
19-
create_time datetime ,
20-
archived tinyint(1) default '0',
21-
email varchar(255),
22-
password varchar(255) not null,
23-
phone varchar(255),
24-
username varchar(255) not null unique,
25-
default_user tinyint(1) default '0',
26-
last_login_time datetime ,
27-
PRIMARY KEY (id)
28-
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
15+
Drop table if exists user_;
16+
CREATE TABLE user_
17+
(
18+
id int(11) NOT NULL auto_increment,
19+
guid varchar(255) not null unique,
20+
create_time datetime,
21+
archived tinyint(1) default '0',
22+
updated_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
23+
username varchar(255) not null unique,
24+
password varchar(255) not null,
25+
enabled tinyint(1) default '1',
26+
phone varchar(255),
27+
email varchar(255),
28+
address varchar(255),
29+
nickname varchar(255),
30+
updated_at int(15) default 0,
31+
default_user tinyint(1) default '0',
32+
last_login_time datetime,
33+
PRIMARY KEY (id),
34+
index idx_username (username)
35+
) ENGINE = InnoDB
36+
AUTO_INCREMENT = 20
37+
DEFAULT CHARSET = utf8;
2938

3039

3140
-- ###############
3241
-- Domain: Privilege
3342
-- ###############
34-
Drop table if exists user_privilege;
35-
CREATE TABLE user_privilege (
36-
user_id int(11),
37-
privilege varchar(255),
38-
KEY user_id_index (user_id)
39-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
43+
Drop table if exists user_privilege;
44+
CREATE TABLE user_privilege
45+
(
46+
user_id int(11),
47+
privilege varchar(255),
48+
KEY user_id_index (user_id)
49+
) ENGINE = InnoDB
50+
DEFAULT CHARSET = utf8;
4051

others/database/oauth.ddl

Lines changed: 75 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,84 @@
11
--
2-
-- Oauth sql -- MYSQL
2+
-- Oauth sql -- MYSQL v3.0.0
33
--
44

5-
Drop table if exists oauth_client_details;
6-
create table oauth_client_details (
7-
client_id VARCHAR(255) PRIMARY KEY,
8-
resource_ids VARCHAR(255),
9-
client_secret VARCHAR(255),
10-
scope VARCHAR(255),
11-
authorized_grant_types VARCHAR(255),
12-
web_server_redirect_uri VARCHAR(255),
13-
authorities VARCHAR(255),
14-
access_token_validity INTEGER,
15-
refresh_token_validity INTEGER,
16-
additional_information TEXT,
17-
create_time timestamp default now(),
18-
archived tinyint(1) default '0',
19-
trusted tinyint(1) default '0',
20-
autoapprove VARCHAR (255) default 'false'
21-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
5+
Drop table if exists oauth2_registered_client;
6+
CREATE TABLE oauth2_registered_client
7+
(
8+
id varchar(100) NOT NULL,
9+
archived TINYINT(1) DEFAULT '0',
10+
create_time DATETIME,
11+
updated_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
12+
client_id varchar(100) NOT NULL,
13+
client_id_issued_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
14+
client_secret varchar(200) DEFAULT NULL,
15+
client_secret_expires_at datetime DEFAULT NULL,
16+
client_name varchar(200) NOT NULL,
17+
client_authentication_methods varchar(1000) NOT NULL,
18+
authorization_grant_types varchar(1000) NOT NULL,
19+
redirect_uris varchar(1000) DEFAULT NULL,
20+
post_logout_redirect_uris varchar(1000) DEFAULT NULL,
21+
scopes varchar(1000) NOT NULL,
22+
client_settings varchar(2000) NOT NULL,
23+
token_settings varchar(2000) NOT NULL,
24+
PRIMARY KEY (id)
25+
) ENGINE = InnoDB
26+
DEFAULT CHARSET = utf8;
2227

28+
-- authorization
29+
Drop table if exists oauth2_authorization;
30+
CREATE TABLE oauth2_authorization
31+
(
32+
id varchar(100) NOT NULL,
33+
registered_client_id varchar(100) NOT NULL,
34+
principal_name varchar(200) NOT NULL,
35+
authorization_grant_type varchar(100) NOT NULL,
36+
authorized_scopes varchar(1000) DEFAULT NULL,
37+
attributes blob DEFAULT NULL,
38+
state varchar(500) DEFAULT NULL,
39+
authorization_code_value blob DEFAULT NULL,
40+
authorization_code_issued_at datetime DEFAULT NULL,
41+
authorization_code_expires_at datetime DEFAULT NULL,
42+
authorization_code_metadata blob DEFAULT NULL,
43+
access_token_value blob DEFAULT NULL,
44+
access_token_issued_at datetime DEFAULT NULL,
45+
access_token_expires_at datetime DEFAULT NULL,
46+
access_token_metadata blob DEFAULT NULL,
47+
access_token_type varchar(100) DEFAULT NULL,
48+
access_token_scopes varchar(1000) DEFAULT NULL,
49+
oidc_id_token_value blob DEFAULT NULL,
50+
oidc_id_token_issued_at datetime DEFAULT NULL,
51+
oidc_id_token_expires_at datetime DEFAULT NULL,
52+
oidc_id_token_metadata blob DEFAULT NULL,
53+
refresh_token_value blob DEFAULT NULL,
54+
refresh_token_issued_at datetime DEFAULT NULL,
55+
refresh_token_expires_at datetime DEFAULT NULL,
56+
refresh_token_metadata blob DEFAULT NULL,
57+
user_code_value blob DEFAULT NULL,
58+
user_code_issued_at datetime DEFAULT NULL,
59+
user_code_expires_at datetime DEFAULT NULL,
60+
user_code_metadata blob DEFAULT NULL,
61+
device_code_value blob DEFAULT NULL,
62+
device_code_issued_at datetime DEFAULT NULL,
63+
device_code_expires_at datetime DEFAULT NULL,
64+
device_code_metadata blob DEFAULT NULL,
65+
updated_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
66+
PRIMARY KEY (id)
67+
) ENGINE = InnoDB
68+
DEFAULT CHARSET = utf8;
2369

24-
Drop table if exists oauth_access_token;
25-
create table oauth_access_token (
26-
create_time timestamp default now(),
27-
token_id VARCHAR(255),
28-
token BLOB,
29-
authentication_id VARCHAR(255),
30-
user_name VARCHAR(255),
31-
client_id VARCHAR(255),
32-
authentication BLOB,
33-
refresh_token VARCHAR(255)
34-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3570

71+
-- authorization consent
72+
Drop table if exists oauth2_authorization_consent;
73+
CREATE TABLE oauth2_authorization_consent
74+
(
75+
registered_client_id varchar(100) NOT NULL,
76+
principal_name varchar(200) NOT NULL,
77+
authorities varchar(1000) NOT NULL,
78+
updated_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
79+
PRIMARY KEY (registered_client_id, principal_name)
80+
) ENGINE = InnoDB
81+
DEFAULT CHARSET = utf8;
3682

37-
Drop table if exists oauth_refresh_token;
38-
create table oauth_refresh_token (
39-
create_time timestamp default now(),
40-
token_id VARCHAR(255),
41-
token BLOB,
42-
authentication BLOB
43-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
44-
45-
46-
Drop table if exists oauth_code;
47-
create table oauth_code (
48-
create_time timestamp default now(),
49-
code VARCHAR(255),
50-
authentication BLOB
51-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
52-
53-
54-
55-
-- Add indexes
56-
create index token_id_index on oauth_access_token (token_id);
57-
create index authentication_id_index on oauth_access_token (authentication_id);
58-
create index user_name_index on oauth_access_token (user_name);
59-
create index client_id_index on oauth_access_token (client_id);
60-
create index refresh_token_index on oauth_access_token (refresh_token);
61-
62-
create index token_id_index on oauth_refresh_token (token_id);
63-
64-
create index code_index on oauth_code (code);
6583

6684

0 commit comments

Comments
 (0)