Skip to content

Commit b96db2e

Browse files
authored
Merge pull request #18 from littleniannian/feat_token_login
feat: 增加 token 登录方式
2 parents a37e5b0 + 05ca769 commit b96db2e

File tree

5 files changed

+191
-70
lines changed

5 files changed

+191
-70
lines changed

src/main/java/com/actiontech/sqle/config/SQLESettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class SQLESettings extends Observable implements PersistentStateComponent
2727
private String DataSourceName;
2828
private String SchemaName;
2929
private String Token;
30+
private String AccessToken;
31+
private String LoginType;
3032

3133
public static SQLESettings getInstance() {
3234
return ServiceManager.getService(SQLESettings.class);

src/main/java/com/actiontech/sqle/constant/Constant.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ public class Constant {
1010
public static final String NOT_SUPPORT_CHARACTER = "!@#$%^&*()_+=-~\\][{}\"\':/;<>?.,`";
1111
public static final JBDimension DIALOG_SIZE = JBUI.size(700, 480);
1212
public static final String COMMON_ERROR_MESSAGE = "Please check selected content doesn't have syntax error and SQLE configuration is correct";
13+
public static final String LOGIN_TYPE_PASSWORD = "password";
14+
public static final String LOGIN_TYPE_TOKEN = "token";
15+
public static final String BEARER_TOKEN_PREFIX = "Bearer ";
1316
}

src/main/java/com/actiontech/sqle/from/SQLESettingUI.form

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<properties/>
1717
<border type="none"/>
1818
<children>
19-
<grid id="e9b09" layout-manager="GridLayoutManager" row-count="10" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
19+
<grid id="e9b09" layout-manager="GridLayoutManager" row-count="12" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
2020
<margin top="0" left="0" bottom="0" right="0"/>
2121
<constraints>
2222
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -36,15 +36,15 @@
3636
</component>
3737
<component id="45402" class="javax.swing.JTextField" binding="sqleUserName">
3838
<constraints>
39-
<grid row="3" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
39+
<grid row="4" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
4040
<preferred-size width="150" height="-1"/>
4141
</grid>
4242
</constraints>
4343
<properties/>
4444
</component>
45-
<component id="baf54" class="javax.swing.JLabel">
45+
<component id="baf54" class="javax.swing.JLabel" binding="passwordLabel">
4646
<constraints>
47-
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false">
47+
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false">
4848
<preferred-size width="40" height="16"/>
4949
</grid>
5050
</constraints>
@@ -58,7 +58,7 @@
5858
</component>
5959
<component id="4c13b" class="javax.swing.JPasswordField" binding="sqlePassword">
6060
<constraints>
61-
<grid row="4" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
61+
<grid row="5" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
6262
<preferred-size width="150" height="-1"/>
6363
</grid>
6464
</constraints>
@@ -72,9 +72,9 @@
7272
<enabled value="true"/>
7373
</properties>
7474
</component>
75-
<component id="d0587" class="javax.swing.JLabel">
75+
<component id="d0587" class="javax.swing.JLabel" binding="userNameLabel">
7676
<constraints>
77-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
77+
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
7878
</constraints>
7979
<properties>
8080
<text value="UserName"/>
@@ -91,7 +91,7 @@
9191
<grid id="6c7cb" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
9292
<margin top="0" left="0" bottom="0" right="0"/>
9393
<constraints>
94-
<grid row="5" column="1" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
94+
<grid row="7" column="1" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
9595
</constraints>
9696
<properties/>
9797
<border type="none"/>
@@ -149,62 +149,92 @@
149149
</component>
150150
<component id="32a19" class="javax.swing.JLabel">
151151
<constraints>
152-
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
152+
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
153153
</constraints>
154154
<properties>
155155
<text value="DB Type"/>
156156
</properties>
157157
</component>
158158
<component id="972a9" class="javax.swing.JComboBox" binding="dbTypeBox">
159159
<constraints>
160-
<grid row="7" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
160+
<grid row="9" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
161161
</constraints>
162162
<properties>
163163
<model/>
164164
</properties>
165165
</component>
166166
<component id="376d" class="javax.swing.JLabel">
167167
<constraints>
168-
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
168+
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
169169
</constraints>
170170
<properties>
171171
<text value="Data Source"/>
172172
</properties>
173173
</component>
174174
<component id="997e0" class="javax.swing.JComboBox" binding="dbDataSourceBox">
175175
<constraints>
176-
<grid row="8" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
176+
<grid row="10" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
177177
</constraints>
178178
<properties/>
179179
</component>
180180
<component id="61335" class="javax.swing.JLabel">
181181
<constraints>
182-
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
182+
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
183183
</constraints>
184184
<properties>
185185
<text value="Projcet"/>
186186
</properties>
187187
</component>
188188
<component id="e1f7f" class="javax.swing.JComboBox" binding="projectBox" default-binding="true">
189189
<constraints>
190-
<grid row="6" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
190+
<grid row="8" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
191191
</constraints>
192192
<properties/>
193193
</component>
194194
<component id="98ca1" class="javax.swing.JLabel">
195195
<constraints>
196-
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
196+
<grid row="11" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
197197
</constraints>
198198
<properties>
199199
<text value="Schema"/>
200200
</properties>
201201
</component>
202202
<component id="74689" class="javax.swing.JComboBox" binding="SchemaBox" default-binding="true">
203203
<constraints>
204-
<grid row="9" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
204+
<grid row="11" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
205+
</constraints>
206+
<properties/>
207+
</component>
208+
<component id="e6957" class="javax.swing.JComboBox" binding="loginTypeBox">
209+
<constraints>
210+
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
211+
</constraints>
212+
<properties/>
213+
</component>
214+
<component id="ddeed" class="javax.swing.JLabel">
215+
<constraints>
216+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
217+
</constraints>
218+
<properties>
219+
<text value="Login Type"/>
220+
</properties>
221+
</component>
222+
<component id="49279" class="javax.swing.JTextField" binding="token">
223+
<constraints>
224+
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
225+
<preferred-size width="150" height="-1"/>
226+
</grid>
205227
</constraints>
206228
<properties/>
207229
</component>
230+
<component id="e5ebe" class="javax.swing.JLabel" binding="tokenLabel">
231+
<constraints>
232+
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
233+
</constraints>
234+
<properties>
235+
<text value="Token"/>
236+
</properties>
237+
</component>
208238
</children>
209239
</grid>
210240
</children>

0 commit comments

Comments
 (0)