Browse Source

三方登录等

root 5 years ago
parent
commit
905809e689

BIN
1.dmp


+ 2 - 2
facade/src/app/routes/passport/login/login.component.ts

@@ -116,8 +116,8 @@ export class UserLoginComponent implements OnDestroy {
116 116
 
117 117
     const data = {
118 118
         grant_type: 'password',
119
-        client_id: this.settingsService.app.clientId || environment.client_id,
120
-        client_secret: this.settingsService.app.clientSecret || environment.client_secret,
119
+        client_id: this.settingsService.user.client.clientId || environment.client_id,
120
+        client_secret: this.settingsService.user.client.clientSecret || environment.client_secret,
121 121
         scope: '*',
122 122
         username: this.userName.value,
123 123
         password: this.password.value,

+ 8 - 0
src/main/java/com/kingkong/bljs/api/IndexController.java

@@ -3,6 +3,7 @@ package com.kingkong.bljs.api;
3 3
 import com.alibaba.fastjson.JSONArray;
4 4
 import com.alibaba.fastjson.JSONObject;
5 5
 import com.kingkong.bljs.dao.AppMapper;
6
+import com.kingkong.bljs.dao.ClientMapper;
6 7
 import com.kingkong.bljs.dao.ThreeloginMapper;
7 8
 import com.kingkong.bljs.entity.App;
8 9
 import com.kingkong.bljs.security.CustomUser;
@@ -61,6 +62,9 @@ public class IndexController extends ApiController {
61 62
     @Autowired
62 63
     private ThreeloginMapper threeloginMapper;
63 64
 
65
+    @Autowired
66
+    private  ClientMapper clientMapper;
67
+
64 68
 
65 69
     @GetMapping("app")
66 70
     public Map app(@RequestParam("app_id") String app_id) throws Exception{
@@ -72,6 +76,8 @@ public class IndexController extends ApiController {
72 76
         Map user = new HashMap();
73 77
         user.put("threeLogin", threeloginMapper.selectByAppId(app_id));
74 78
 
79
+        user.put("client" , clientMapper.selectDefaultClient(app_id));
80
+
75 81
         result.put("user",user);
76 82
 
77 83
         return result;
@@ -88,6 +94,8 @@ public class IndexController extends ApiController {
88 94
         Map user = userService.getCurrentUser();
89 95
         user.put("threeLogin", threeloginMapper.selectByAppId(app_id));
90 96
 
97
+        user.put("client" , clientMapper.selectDefaultClient(app_id));
98
+
91 99
         result.put("app",appInfo(app_id));
92 100
         if(null == user){
93 101
             result.put("user",new HashMap<>());

+ 10 - 20
src/main/java/com/kingkong/bljs/dao/AppMapper.java

@@ -12,7 +12,7 @@ public interface AppMapper {
12 12
      * This method was generated by MyBatis Generator.
13 13
      * This method corresponds to the database table K_USER.K_APP
14 14
      *
15
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
15
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
16 16
      */
17 17
     @Delete({
18 18
         "delete from K_USER.K_APP",
@@ -24,19 +24,17 @@ public interface AppMapper {
24 24
      * This method was generated by MyBatis Generator.
25 25
      * This method corresponds to the database table K_USER.K_APP
26 26
      *
27
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
27
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
28 28
      */
29 29
     @Insert({
30 30
         "insert into K_USER.K_APP (ID, NAME, ",
31 31
         "NOTE, STATUS, ICON, ",
32 32
         "CREATED_AT, UPDATED_AT, ",
33
-        "DELETED_AT, CLIENT_ID, ",
34
-        "CLIENT_SECRET, REDIRECT_URI)",
33
+        "DELETED_AT)",
35 34
         "values (#{id,jdbcType=DECIMAL}, #{name,jdbcType=VARCHAR}, ",
36 35
         "#{note,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, #{icon,jdbcType=VARCHAR}, ",
37 36
         "#{createdAt,jdbcType=DATE}, #{updatedAt,jdbcType=DATE}, ",
38
-        "#{deletedAt,jdbcType=DATE}, #{clientId,jdbcType=VARCHAR}, ",
39
-        "#{clientSecret,jdbcType=VARCHAR}, #{redirectUri,jdbcType=VARCHAR})"
37
+        "#{deletedAt,jdbcType=DATE})"
40 38
     })
41 39
     int insert(App record);
42 40
 
@@ -44,7 +42,7 @@ public interface AppMapper {
44 42
      * This method was generated by MyBatis Generator.
45 43
      * This method corresponds to the database table K_USER.K_APP
46 44
      *
47
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
45
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
48 46
      */
49 47
     int insertSelective(App record);
50 48
 
@@ -52,12 +50,11 @@ public interface AppMapper {
52 50
      * This method was generated by MyBatis Generator.
53 51
      * This method corresponds to the database table K_USER.K_APP
54 52
      *
55
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
53
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
56 54
      */
57 55
     @Select({
58 56
         "select",
59
-        "ID, NAME, NOTE, STATUS, ICON, CREATED_AT, UPDATED_AT, DELETED_AT, CLIENT_ID, ",
60
-        "CLIENT_SECRET, REDIRECT_URI",
57
+        "ID, NAME, NOTE, STATUS, ICON, CREATED_AT, UPDATED_AT, DELETED_AT",
61 58
         "from K_USER.K_APP",
62 59
         "where ID = #{id,jdbcType=DECIMAL}"
63 60
     })
@@ -68,7 +65,7 @@ public interface AppMapper {
68 65
      * This method was generated by MyBatis Generator.
69 66
      * This method corresponds to the database table K_USER.K_APP
70 67
      *
71
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
68
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
72 69
      */
73 70
     int updateByPrimaryKeySelective(App record);
74 71
 
@@ -76,7 +73,7 @@ public interface AppMapper {
76 73
      * This method was generated by MyBatis Generator.
77 74
      * This method corresponds to the database table K_USER.K_APP
78 75
      *
79
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
76
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
80 77
      */
81 78
     @Update({
82 79
         "update K_USER.K_APP",
@@ -86,15 +83,8 @@ public interface AppMapper {
86 83
           "ICON = #{icon,jdbcType=VARCHAR},",
87 84
           "CREATED_AT = #{createdAt,jdbcType=DATE},",
88 85
           "UPDATED_AT = #{updatedAt,jdbcType=DATE},",
89
-          "DELETED_AT = #{deletedAt,jdbcType=DATE},",
90
-          "CLIENT_ID = #{clientId,jdbcType=VARCHAR},",
91
-          "CLIENT_SECRET = #{clientSecret,jdbcType=VARCHAR},",
92
-          "REDIRECT_URI = #{redirectUri,jdbcType=VARCHAR}",
86
+          "DELETED_AT = #{deletedAt,jdbcType=DATE}",
93 87
         "where ID = #{id,jdbcType=DECIMAL}"
94 88
     })
95 89
     int updateByPrimaryKey(App record);
96
-
97
-
98
-    @Select({"select * from k_app where client_id=#{clientId}"})
99
-    App selectByClientId(String clientId);
100 90
 }

+ 21 - 12
src/main/java/com/kingkong/bljs/dao/ClientMapper.java

@@ -12,7 +12,7 @@ public interface ClientMapper {
12 12
      * This method was generated by MyBatis Generator.
13 13
      * This method corresponds to the database table K_USER.K_CLIENT
14 14
      *
15
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
15
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
16 16
      */
17 17
     @Delete({
18 18
         "delete from K_USER.K_CLIENT",
@@ -24,19 +24,19 @@ public interface ClientMapper {
24 24
      * This method was generated by MyBatis Generator.
25 25
      * This method corresponds to the database table K_USER.K_CLIENT
26 26
      *
27
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
27
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
28 28
      */
29 29
     @Insert({
30 30
         "insert into K_USER.K_CLIENT (CLIENT_ID, ID, ",
31 31
         "NAME, CLIENT_SECRET, ",
32 32
         "REDIRECT_URI, CREATED_AT, ",
33 33
         "UPDATED_AT, DELETED_AT, ",
34
-        "APP_ID)",
34
+        "APP_ID, TYPE)",
35 35
         "values (#{clientId,jdbcType=VARCHAR}, #{id,jdbcType=DECIMAL}, ",
36 36
         "#{name,jdbcType=VARCHAR}, #{clientSecret,jdbcType=VARCHAR}, ",
37 37
         "#{redirectUri,jdbcType=VARCHAR}, #{createdAt,jdbcType=DATE}, ",
38 38
         "#{updatedAt,jdbcType=DATE}, #{deletedAt,jdbcType=DATE}, ",
39
-        "#{appId,jdbcType=DECIMAL})"
39
+        "#{appId,jdbcType=DECIMAL}, #{type,jdbcType=DECIMAL})"
40 40
     })
41 41
     int insert(Client record);
42 42
 
@@ -44,7 +44,7 @@ public interface ClientMapper {
44 44
      * This method was generated by MyBatis Generator.
45 45
      * This method corresponds to the database table K_USER.K_CLIENT
46 46
      *
47
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
47
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
48 48
      */
49 49
     int insertSelective(Client record);
50 50
 
@@ -52,12 +52,12 @@ public interface ClientMapper {
52 52
      * This method was generated by MyBatis Generator.
53 53
      * This method corresponds to the database table K_USER.K_CLIENT
54 54
      *
55
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
55
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
56 56
      */
57 57
     @Select({
58 58
         "select",
59 59
         "CLIENT_ID, ID, NAME, CLIENT_SECRET, REDIRECT_URI, CREATED_AT, UPDATED_AT, DELETED_AT, ",
60
-        "APP_ID",
60
+        "APP_ID, TYPE",
61 61
         "from K_USER.K_CLIENT",
62 62
         "where CLIENT_ID = #{clientId,jdbcType=VARCHAR}"
63 63
     })
@@ -68,7 +68,7 @@ public interface ClientMapper {
68 68
      * This method was generated by MyBatis Generator.
69 69
      * This method corresponds to the database table K_USER.K_CLIENT
70 70
      *
71
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
71
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
72 72
      */
73 73
     int updateByPrimaryKeySelective(Client record);
74 74
 
@@ -76,7 +76,7 @@ public interface ClientMapper {
76 76
      * This method was generated by MyBatis Generator.
77 77
      * This method corresponds to the database table K_USER.K_CLIENT
78 78
      *
79
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
79
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
80 80
      */
81 81
     @Update({
82 82
         "update K_USER.K_CLIENT",
@@ -87,11 +87,20 @@ public interface ClientMapper {
87 87
           "CREATED_AT = #{createdAt,jdbcType=DATE},",
88 88
           "UPDATED_AT = #{updatedAt,jdbcType=DATE},",
89 89
           "DELETED_AT = #{deletedAt,jdbcType=DATE},",
90
-          "APP_ID = #{appId,jdbcType=DECIMAL}",
90
+          "APP_ID = #{appId,jdbcType=DECIMAL},",
91
+          "TYPE = #{type,jdbcType=DECIMAL}",
91 92
         "where CLIENT_ID = #{clientId,jdbcType=VARCHAR}"
92 93
     })
93 94
     int updateByPrimaryKey(Client record);
94 95
 
95
-    @Select({"select * from k_client where client_id=#{clientId}"})
96
-    Client selectByClientId(String clientId);
96
+
97
+    @Select({
98
+            "select",
99
+            "CLIENT_ID, ID, NAME, CLIENT_SECRET, REDIRECT_URI, CREATED_AT, UPDATED_AT, DELETED_AT, ",
100
+            "APP_ID, TYPE",
101
+            "from K_USER.K_CLIENT",
102
+            "where app_id = #{appId,jdbcType=DECIMAL} and type=1"
103
+    })
104
+    @ResultMap("com.kingkong.bljs.dao.ClientMapper.BaseResultMap")
105
+    Client selectDefaultClient(String appId);
97 106
 }

+ 18 - 84
src/main/java/com/kingkong/bljs/entity/App.java

@@ -8,7 +8,7 @@ public class App {
8 8
      * This field was generated by MyBatis Generator.
9 9
      * This field corresponds to the database column K_USER.K_APP.ID
10 10
      *
11
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
11
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
12 12
      */
13 13
     private Integer id;
14 14
 
@@ -17,7 +17,7 @@ public class App {
17 17
      * This field was generated by MyBatis Generator.
18 18
      * This field corresponds to the database column K_USER.K_APP.NAME
19 19
      *
20
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
20
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
21 21
      */
22 22
     private String name;
23 23
 
@@ -26,7 +26,7 @@ public class App {
26 26
      * This field was generated by MyBatis Generator.
27 27
      * This field corresponds to the database column K_USER.K_APP.NOTE
28 28
      *
29
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
29
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
30 30
      */
31 31
     private String note;
32 32
 
@@ -35,7 +35,7 @@ public class App {
35 35
      * This field was generated by MyBatis Generator.
36 36
      * This field corresponds to the database column K_USER.K_APP.STATUS
37 37
      *
38
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
38
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
39 39
      */
40 40
     private Short status;
41 41
 
@@ -44,7 +44,7 @@ public class App {
44 44
      * This field was generated by MyBatis Generator.
45 45
      * This field corresponds to the database column K_USER.K_APP.ICON
46 46
      *
47
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
47
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
48 48
      */
49 49
     private String icon;
50 50
 
@@ -53,7 +53,7 @@ public class App {
53 53
      * This field was generated by MyBatis Generator.
54 54
      * This field corresponds to the database column K_USER.K_APP.CREATED_AT
55 55
      *
56
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
56
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
57 57
      */
58 58
     private Date createdAt;
59 59
 
@@ -62,7 +62,7 @@ public class App {
62 62
      * This field was generated by MyBatis Generator.
63 63
      * This field corresponds to the database column K_USER.K_APP.UPDATED_AT
64 64
      *
65
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
65
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
66 66
      */
67 67
     private Date updatedAt;
68 68
 
@@ -71,44 +71,17 @@ public class App {
71 71
      * This field was generated by MyBatis Generator.
72 72
      * This field corresponds to the database column K_USER.K_APP.DELETED_AT
73 73
      *
74
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
74
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
75 75
      */
76 76
     private Date deletedAt;
77 77
 
78
-    /**
79
-     *
80
-     * This field was generated by MyBatis Generator.
81
-     * This field corresponds to the database column K_USER.K_APP.CLIENT_ID
82
-     *
83
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
84
-     */
85
-    private String clientId;
86
-
87
-    /**
88
-     *
89
-     * This field was generated by MyBatis Generator.
90
-     * This field corresponds to the database column K_USER.K_APP.CLIENT_SECRET
91
-     *
92
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
93
-     */
94
-    private String clientSecret;
95
-
96
-    /**
97
-     *
98
-     * This field was generated by MyBatis Generator.
99
-     * This field corresponds to the database column K_USER.K_APP.REDIRECT_URI
100
-     *
101
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
102
-     */
103
-    private String redirectUri;
104
-
105 78
     /**
106 79
      * This method was generated by MyBatis Generator.
107 80
      * This method corresponds to the database table K_USER.K_APP
108 81
      *
109
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
82
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
110 83
      */
111
-    public App(Integer id, String name, String note, Short status, String icon, Date createdAt, Date updatedAt, Date deletedAt, String clientId, String clientSecret, String redirectUri) {
84
+    public App(Integer id, String name, String note, Short status, String icon, Date createdAt, Date updatedAt, Date deletedAt) {
112 85
         this.id = id;
113 86
         this.name = name;
114 87
         this.note = note;
@@ -117,9 +90,6 @@ public class App {
117 90
         this.createdAt = createdAt;
118 91
         this.updatedAt = updatedAt;
119 92
         this.deletedAt = deletedAt;
120
-        this.clientId = clientId;
121
-        this.clientSecret = clientSecret;
122
-        this.redirectUri = redirectUri;
123 93
     }
124 94
 
125 95
     /**
@@ -128,7 +98,7 @@ public class App {
128 98
      *
129 99
      * @return the value of K_USER.K_APP.ID
130 100
      *
131
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
101
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
132 102
      */
133 103
     public Integer getId() {
134 104
         return id;
@@ -140,7 +110,7 @@ public class App {
140 110
      *
141 111
      * @return the value of K_USER.K_APP.NAME
142 112
      *
143
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
113
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
144 114
      */
145 115
     public String getName() {
146 116
         return name;
@@ -152,7 +122,7 @@ public class App {
152 122
      *
153 123
      * @return the value of K_USER.K_APP.NOTE
154 124
      *
155
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
125
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
156 126
      */
157 127
     public String getNote() {
158 128
         return note;
@@ -164,7 +134,7 @@ public class App {
164 134
      *
165 135
      * @return the value of K_USER.K_APP.STATUS
166 136
      *
167
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
137
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
168 138
      */
169 139
     public Short getStatus() {
170 140
         return status;
@@ -176,7 +146,7 @@ public class App {
176 146
      *
177 147
      * @return the value of K_USER.K_APP.ICON
178 148
      *
179
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
149
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
180 150
      */
181 151
     public String getIcon() {
182 152
         return icon;
@@ -188,7 +158,7 @@ public class App {
188 158
      *
189 159
      * @return the value of K_USER.K_APP.CREATED_AT
190 160
      *
191
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
161
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
192 162
      */
193 163
     public Date getCreatedAt() {
194 164
         return createdAt;
@@ -200,7 +170,7 @@ public class App {
200 170
      *
201 171
      * @return the value of K_USER.K_APP.UPDATED_AT
202 172
      *
203
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
173
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
204 174
      */
205 175
     public Date getUpdatedAt() {
206 176
         return updatedAt;
@@ -212,45 +182,9 @@ public class App {
212 182
      *
213 183
      * @return the value of K_USER.K_APP.DELETED_AT
214 184
      *
215
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
185
+     * @mbg.generated Mon May 27 17:44:13 CST 2019
216 186
      */
217 187
     public Date getDeletedAt() {
218 188
         return deletedAt;
219 189
     }
220
-
221
-    /**
222
-     * This method was generated by MyBatis Generator.
223
-     * This method returns the value of the database column K_USER.K_APP.CLIENT_ID
224
-     *
225
-     * @return the value of K_USER.K_APP.CLIENT_ID
226
-     *
227
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
228
-     */
229
-    public String getClientId() {
230
-        return clientId;
231
-    }
232
-
233
-    /**
234
-     * This method was generated by MyBatis Generator.
235
-     * This method returns the value of the database column K_USER.K_APP.CLIENT_SECRET
236
-     *
237
-     * @return the value of K_USER.K_APP.CLIENT_SECRET
238
-     *
239
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
240
-     */
241
-    public String getClientSecret() {
242
-        return clientSecret;
243
-    }
244
-
245
-    /**
246
-     * This method was generated by MyBatis Generator.
247
-     * This method returns the value of the database column K_USER.K_APP.REDIRECT_URI
248
-     *
249
-     * @return the value of K_USER.K_APP.REDIRECT_URI
250
-     *
251
-     * @mbg.generated Fri May 24 16:36:22 CST 2019
252
-     */
253
-    public String getRedirectUri() {
254
-        return redirectUri;
255
-    }
256 190
 }

+ 42 - 20
src/main/java/com/kingkong/bljs/entity/Client.java

@@ -8,7 +8,7 @@ public class Client {
8 8
      * This field was generated by MyBatis Generator.
9 9
      * This field corresponds to the database column K_USER.K_CLIENT.CLIENT_ID
10 10
      *
11
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
11
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
12 12
      */
13 13
     private String clientId;
14 14
 
@@ -17,7 +17,7 @@ public class Client {
17 17
      * This field was generated by MyBatis Generator.
18 18
      * This field corresponds to the database column K_USER.K_CLIENT.ID
19 19
      *
20
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
20
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
21 21
      */
22 22
     private Integer id;
23 23
 
@@ -26,7 +26,7 @@ public class Client {
26 26
      * This field was generated by MyBatis Generator.
27 27
      * This field corresponds to the database column K_USER.K_CLIENT.NAME
28 28
      *
29
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
29
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
30 30
      */
31 31
     private String name;
32 32
 
@@ -35,7 +35,7 @@ public class Client {
35 35
      * This field was generated by MyBatis Generator.
36 36
      * This field corresponds to the database column K_USER.K_CLIENT.CLIENT_SECRET
37 37
      *
38
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
38
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
39 39
      */
40 40
     private String clientSecret;
41 41
 
@@ -44,7 +44,7 @@ public class Client {
44 44
      * This field was generated by MyBatis Generator.
45 45
      * This field corresponds to the database column K_USER.K_CLIENT.REDIRECT_URI
46 46
      *
47
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
47
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
48 48
      */
49 49
     private String redirectUri;
50 50
 
@@ -53,7 +53,7 @@ public class Client {
53 53
      * This field was generated by MyBatis Generator.
54 54
      * This field corresponds to the database column K_USER.K_CLIENT.CREATED_AT
55 55
      *
56
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
56
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
57 57
      */
58 58
     private Date createdAt;
59 59
 
@@ -62,7 +62,7 @@ public class Client {
62 62
      * This field was generated by MyBatis Generator.
63 63
      * This field corresponds to the database column K_USER.K_CLIENT.UPDATED_AT
64 64
      *
65
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
65
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
66 66
      */
67 67
     private Date updatedAt;
68 68
 
@@ -71,7 +71,7 @@ public class Client {
71 71
      * This field was generated by MyBatis Generator.
72 72
      * This field corresponds to the database column K_USER.K_CLIENT.DELETED_AT
73 73
      *
74
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
74
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
75 75
      */
76 76
     private Date deletedAt;
77 77
 
@@ -80,17 +80,26 @@ public class Client {
80 80
      * This field was generated by MyBatis Generator.
81 81
      * This field corresponds to the database column K_USER.K_CLIENT.APP_ID
82 82
      *
83
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
83
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
84 84
      */
85 85
     private Integer appId;
86 86
 
87
+    /**
88
+     *
89
+     * This field was generated by MyBatis Generator.
90
+     * This field corresponds to the database column K_USER.K_CLIENT.TYPE
91
+     *
92
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
93
+     */
94
+    private Short type;
95
+
87 96
     /**
88 97
      * This method was generated by MyBatis Generator.
89 98
      * This method corresponds to the database table K_USER.K_CLIENT
90 99
      *
91
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
100
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
92 101
      */
93
-    public Client(String clientId, Integer id, String name, String clientSecret, String redirectUri, Date createdAt, Date updatedAt, Date deletedAt, Integer appId) {
102
+    public Client(String clientId, Integer id, String name, String clientSecret, String redirectUri, Date createdAt, Date updatedAt, Date deletedAt, Integer appId, Short type) {
94 103
         this.clientId = clientId;
95 104
         this.id = id;
96 105
         this.name = name;
@@ -100,6 +109,7 @@ public class Client {
100 109
         this.updatedAt = updatedAt;
101 110
         this.deletedAt = deletedAt;
102 111
         this.appId = appId;
112
+        this.type = type;
103 113
     }
104 114
 
105 115
     /**
@@ -108,7 +118,7 @@ public class Client {
108 118
      *
109 119
      * @return the value of K_USER.K_CLIENT.CLIENT_ID
110 120
      *
111
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
121
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
112 122
      */
113 123
     public String getClientId() {
114 124
         return clientId;
@@ -120,7 +130,7 @@ public class Client {
120 130
      *
121 131
      * @return the value of K_USER.K_CLIENT.ID
122 132
      *
123
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
133
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
124 134
      */
125 135
     public Integer getId() {
126 136
         return id;
@@ -132,7 +142,7 @@ public class Client {
132 142
      *
133 143
      * @return the value of K_USER.K_CLIENT.NAME
134 144
      *
135
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
145
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
136 146
      */
137 147
     public String getName() {
138 148
         return name;
@@ -144,7 +154,7 @@ public class Client {
144 154
      *
145 155
      * @return the value of K_USER.K_CLIENT.CLIENT_SECRET
146 156
      *
147
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
157
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
148 158
      */
149 159
     public String getClientSecret() {
150 160
         return clientSecret;
@@ -156,7 +166,7 @@ public class Client {
156 166
      *
157 167
      * @return the value of K_USER.K_CLIENT.REDIRECT_URI
158 168
      *
159
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
169
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
160 170
      */
161 171
     public String getRedirectUri() {
162 172
         return redirectUri;
@@ -168,7 +178,7 @@ public class Client {
168 178
      *
169 179
      * @return the value of K_USER.K_CLIENT.CREATED_AT
170 180
      *
171
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
181
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
172 182
      */
173 183
     public Date getCreatedAt() {
174 184
         return createdAt;
@@ -180,7 +190,7 @@ public class Client {
180 190
      *
181 191
      * @return the value of K_USER.K_CLIENT.UPDATED_AT
182 192
      *
183
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
193
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
184 194
      */
185 195
     public Date getUpdatedAt() {
186 196
         return updatedAt;
@@ -192,7 +202,7 @@ public class Client {
192 202
      *
193 203
      * @return the value of K_USER.K_CLIENT.DELETED_AT
194 204
      *
195
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
205
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
196 206
      */
197 207
     public Date getDeletedAt() {
198 208
         return deletedAt;
@@ -204,9 +214,21 @@ public class Client {
204 214
      *
205 215
      * @return the value of K_USER.K_CLIENT.APP_ID
206 216
      *
207
-     * @mbg.generated Mon May 27 16:39:18 CST 2019
217
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
208 218
      */
209 219
     public Integer getAppId() {
210 220
         return appId;
211 221
     }
222
+
223
+    /**
224
+     * This method was generated by MyBatis Generator.
225
+     * This method returns the value of the database column K_USER.K_CLIENT.TYPE
226
+     *
227
+     * @return the value of K_USER.K_CLIENT.TYPE
228
+     *
229
+     * @mbg.generated Mon May 27 17:34:01 CST 2019
230
+     */
231
+    public Short getType() {
232
+        return type;
233
+    }
212 234
 }

+ 2 - 2
src/main/java/com/kingkong/bljs/security/CustomClientDetailService.java

@@ -22,14 +22,14 @@ public class CustomClientDetailService implements ClientDetailsService {
22 22
     @Override
23 23
     public ClientDetails loadClientByClientId(String s) throws ClientRegistrationException {
24 24
 
25
-        Client client = clientMapper.selectByClientId(s);
25
+        Client client = clientMapper.selectByPrimaryKey(s);
26 26
 
27 27
         if(null == client)
28 28
             throw new ClientRegistrationException("incorrect client id");
29 29
 
30 30
         BaseClientDetails clientDetails = new BaseClientDetails();
31 31
         clientDetails.setClientId(s);
32
-        clientDetails.setClientSecret("{noop}" + client.getClientId());
32
+        clientDetails.setClientSecret("{noop}" + client.getClientSecret());
33 33
         clientDetails.setAuthorizedGrantTypes(Arrays.asList("authorization_code","client_credentials", "refresh_token", "password", "implicit"));
34 34
         clientDetails.setScope(Arrays.asList("*","all"));
35 35
         Set<String> uris = new HashSet<>();

+ 3 - 0
src/main/java/com/kingkong/bljs/security/CustomUserDetailsService.java

@@ -39,6 +39,9 @@ public class CustomUserDetailsService implements UserDetailsService {
39 39
     @Value("${app.default.app_id}")
40 40
     private String default_app_id;
41 41
 
42
+    @Autowired
43
+    private CustomAuthenticationDetailsSource customAuthenticationDetailsSource;
44
+
42 45
 
43 46
 
44 47
     @Override

+ 1 - 1
src/main/resources/generatorConfig.xml

@@ -87,7 +87,7 @@
87 87
 
88 88
 
89 89
 
90
-        <table tableName="k_client" schema="k_user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
90
+        <table tableName="k_app" schema="k_user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
91 91
                enableSelectByExample="false" selectByExampleQueryId="false">
92 92
 
93 93
             <!-- optional   , only for mybatis3 runtime

+ 5 - 36
src/main/resources/mapper/AppMapper.xml

@@ -5,7 +5,7 @@
5 5
     <!--
6 6
       WARNING - @mbg.generated
7 7
       This element is automatically generated by MyBatis Generator, do not modify.
8
-      This element was generated on Fri May 24 16:36:22 CST 2019.
8
+      This element was generated on Mon May 27 17:44:13 CST 2019.
9 9
     -->
10 10
     <constructor>
11 11
       <idArg column="ID" javaType="java.lang.Integer" jdbcType="DECIMAL" />
@@ -16,25 +16,21 @@
16 16
       <arg column="CREATED_AT" javaType="java.util.Date" jdbcType="DATE" />
17 17
       <arg column="UPDATED_AT" javaType="java.util.Date" jdbcType="DATE" />
18 18
       <arg column="DELETED_AT" javaType="java.util.Date" jdbcType="DATE" />
19
-      <arg column="CLIENT_ID" javaType="java.lang.String" jdbcType="VARCHAR" />
20
-      <arg column="CLIENT_SECRET" javaType="java.lang.String" jdbcType="VARCHAR" />
21
-      <arg column="REDIRECT_URI" javaType="java.lang.String" jdbcType="VARCHAR" />
22 19
     </constructor>
23 20
   </resultMap>
24 21
   <sql id="Base_Column_List">
25 22
     <!--
26 23
       WARNING - @mbg.generated
27 24
       This element is automatically generated by MyBatis Generator, do not modify.
28
-      This element was generated on Fri May 24 16:36:22 CST 2019.
25
+      This element was generated on Mon May 27 17:44:13 CST 2019.
29 26
     -->
30
-    ID, NAME, NOTE, STATUS, ICON, CREATED_AT, UPDATED_AT, DELETED_AT, CLIENT_ID, CLIENT_SECRET, 
31
-    REDIRECT_URI
27
+    ID, NAME, NOTE, STATUS, ICON, CREATED_AT, UPDATED_AT, DELETED_AT
32 28
   </sql>
33 29
   <insert id="insertSelective" parameterType="com.kingkong.bljs.entity.App">
34 30
     <!--
35 31
       WARNING - @mbg.generated
36 32
       This element is automatically generated by MyBatis Generator, do not modify.
37
-      This element was generated on Fri May 24 16:36:22 CST 2019.
33
+      This element was generated on Mon May 27 17:44:13 CST 2019.
38 34
     -->
39 35
     insert into K_USER.K_APP
40 36
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -62,15 +58,6 @@
62 58
       <if test="deletedAt != null">
63 59
         DELETED_AT,
64 60
       </if>
65
-      <if test="clientId != null">
66
-        CLIENT_ID,
67
-      </if>
68
-      <if test="clientSecret != null">
69
-        CLIENT_SECRET,
70
-      </if>
71
-      <if test="redirectUri != null">
72
-        REDIRECT_URI,
73
-      </if>
74 61
     </trim>
75 62
     <trim prefix="values (" suffix=")" suffixOverrides=",">
76 63
       <if test="id != null">
@@ -97,22 +84,13 @@
97 84
       <if test="deletedAt != null">
98 85
         #{deletedAt,jdbcType=DATE},
99 86
       </if>
100
-      <if test="clientId != null">
101
-        #{clientId,jdbcType=VARCHAR},
102
-      </if>
103
-      <if test="clientSecret != null">
104
-        #{clientSecret,jdbcType=VARCHAR},
105
-      </if>
106
-      <if test="redirectUri != null">
107
-        #{redirectUri,jdbcType=VARCHAR},
108
-      </if>
109 87
     </trim>
110 88
   </insert>
111 89
   <update id="updateByPrimaryKeySelective" parameterType="com.kingkong.bljs.entity.App">
112 90
     <!--
113 91
       WARNING - @mbg.generated
114 92
       This element is automatically generated by MyBatis Generator, do not modify.
115
-      This element was generated on Fri May 24 16:36:22 CST 2019.
93
+      This element was generated on Mon May 27 17:44:13 CST 2019.
116 94
     -->
117 95
     update K_USER.K_APP
118 96
     <set>
@@ -137,15 +115,6 @@
137 115
       <if test="deletedAt != null">
138 116
         DELETED_AT = #{deletedAt,jdbcType=DATE},
139 117
       </if>
140
-      <if test="clientId != null">
141
-        CLIENT_ID = #{clientId,jdbcType=VARCHAR},
142
-      </if>
143
-      <if test="clientSecret != null">
144
-        CLIENT_SECRET = #{clientSecret,jdbcType=VARCHAR},
145
-      </if>
146
-      <if test="redirectUri != null">
147
-        REDIRECT_URI = #{redirectUri,jdbcType=VARCHAR},
148
-      </if>
149 118
     </set>
150 119
     where ID = #{id,jdbcType=DECIMAL}
151 120
   </update>

+ 15 - 5
src/main/resources/mapper/ClientMapper.xml

@@ -5,7 +5,7 @@
5 5
     <!--
6 6
       WARNING - @mbg.generated
7 7
       This element is automatically generated by MyBatis Generator, do not modify.
8
-      This element was generated on Mon May 27 16:39:18 CST 2019.
8
+      This element was generated on Mon May 27 17:34:01 CST 2019.
9 9
     -->
10 10
     <constructor>
11 11
       <idArg column="CLIENT_ID" javaType="java.lang.String" jdbcType="VARCHAR" />
@@ -17,22 +17,23 @@
17 17
       <arg column="UPDATED_AT" javaType="java.util.Date" jdbcType="DATE" />
18 18
       <arg column="DELETED_AT" javaType="java.util.Date" jdbcType="DATE" />
19 19
       <arg column="APP_ID" javaType="java.lang.Integer" jdbcType="DECIMAL" />
20
+      <arg column="TYPE" javaType="java.lang.Short" jdbcType="DECIMAL" />
20 21
     </constructor>
21 22
   </resultMap>
22 23
   <sql id="Base_Column_List">
23 24
     <!--
24 25
       WARNING - @mbg.generated
25 26
       This element is automatically generated by MyBatis Generator, do not modify.
26
-      This element was generated on Mon May 27 16:39:18 CST 2019.
27
+      This element was generated on Mon May 27 17:34:01 CST 2019.
27 28
     -->
28 29
     CLIENT_ID, ID, NAME, CLIENT_SECRET, REDIRECT_URI, CREATED_AT, UPDATED_AT, DELETED_AT, 
29
-    APP_ID
30
+    APP_ID, TYPE
30 31
   </sql>
31 32
   <insert id="insertSelective" parameterType="com.kingkong.bljs.entity.Client">
32 33
     <!--
33 34
       WARNING - @mbg.generated
34 35
       This element is automatically generated by MyBatis Generator, do not modify.
35
-      This element was generated on Mon May 27 16:39:18 CST 2019.
36
+      This element was generated on Mon May 27 17:34:01 CST 2019.
36 37
     -->
37 38
     insert into K_USER.K_CLIENT
38 39
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -63,6 +64,9 @@
63 64
       <if test="appId != null">
64 65
         APP_ID,
65 66
       </if>
67
+      <if test="type != null">
68
+        TYPE,
69
+      </if>
66 70
     </trim>
67 71
     <trim prefix="values (" suffix=")" suffixOverrides=",">
68 72
       <if test="clientId != null">
@@ -92,13 +96,16 @@
92 96
       <if test="appId != null">
93 97
         #{appId,jdbcType=DECIMAL},
94 98
       </if>
99
+      <if test="type != null">
100
+        #{type,jdbcType=DECIMAL},
101
+      </if>
95 102
     </trim>
96 103
   </insert>
97 104
   <update id="updateByPrimaryKeySelective" parameterType="com.kingkong.bljs.entity.Client">
98 105
     <!--
99 106
       WARNING - @mbg.generated
100 107
       This element is automatically generated by MyBatis Generator, do not modify.
101
-      This element was generated on Mon May 27 16:39:18 CST 2019.
108
+      This element was generated on Mon May 27 17:34:01 CST 2019.
102 109
     -->
103 110
     update K_USER.K_CLIENT
104 111
     <set>
@@ -126,6 +133,9 @@
126 133
       <if test="appId != null">
127 134
         APP_ID = #{appId,jdbcType=DECIMAL},
128 135
       </if>
136
+      <if test="type != null">
137
+        TYPE = #{type,jdbcType=DECIMAL},
138
+      </if>
129 139
     </set>
130 140
     where CLIENT_ID = #{clientId,jdbcType=VARCHAR}
131 141
   </update>