This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new c8386ce2f [seatunnel-1947][seatunnel-server] add user authentication
(#2532)
c8386ce2f is described below
commit c8386ce2f163f0e2f9ef32b5d5c11bfcf880b2e4
Author: dijie <[email protected]>
AuthorDate: Thu Sep 1 16:47:18 2022 +0800
[seatunnel-1947][seatunnel-server] add user authentication (#2532)
Co-authored-by: Kirs <[email protected]>
---
pom.xml | 20 +-
seatunnel-dist/release-docs/LICENSE | 6 +-
.../licenses/LICENSE-aspectjweaver.txt | 279 +++++++++++++++++++++
seatunnel-server/seatunnel-app/pom.xml | 19 ++
.../seatunnel/app/adapter/SeatunnelWebAdapter.java | 62 +++++
.../apache/seatunnel/app/aspect/LoginAspect.java | 75 ++++++
.../apache/seatunnel/app/aspect/LogoutAspect.java | 58 +++++
.../UserSimpleInfoRes.java => aspect/UserId.java} | 12 +-
.../seatunnel/app/common/UserTokenStatusEnum.java} | 14 +-
.../org/apache/seatunnel/app/config/Swagger2.java | 36 +--
.../seatunnel/app/controller/UserController.java | 12 +
.../org/apache/seatunnel/app/dal/dao/IUserDao.java | 10 +
.../seatunnel/app/dal/dao/impl/UserDaoImpl.java | 32 +++
.../entity/UserLoginLog.java} | 21 +-
.../mapper/UserLoginLogMapper.java} | 18 +-
.../seatunnel/app/dal/mapper/UserMapper.java | 2 +
.../user/UserLoginLogDto.java} | 17 +-
.../app/domain/request/user/UserLoginReq.java} | 12 +-
.../domain/response/user/UserSimpleInfoRes.java | 15 +-
.../app/interceptor/AuthenticationInterceptor.java | 97 +++++++
.../app/resolver/UserIdMethodArgumentResolver.java | 45 ++++
.../apache/seatunnel/app/security/JwtUtils.java | 66 +++++
.../apache/seatunnel/app/service/IUserService.java | 3 +
.../app/service/impl/UserServiceImpl.java | 18 ++
.../src/main/resources/application.yml | 20 +-
.../app/dal/mapper/UserLoginLogMapper.xml | 58 +++++
.../apache/seatunnel/app/dal/mapper/UserMapper.xml | 6 +
.../apache/seatunnel/server/common/Constants.java | 4 +
.../server/common/SeatunnelErrorEnum.java | 10 +-
tools/dependencies/known-dependencies.txt | 5 +
30 files changed, 984 insertions(+), 68 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5c37c7b84..0f3689c50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -231,6 +231,7 @@
<phoenix.version>5.2.5-HBase-2.x</phoenix.version>
<awaitility.version>4.2.0</awaitility.version>
<neo4j-java-driver.version>4.4.9</neo4j-java-driver.version>
+ <jwt.version>0.10.7</jwt.version>
<jedis.version>4.2.2</jedis.version>
<datahub.version>2.19.0-public</datahub.version>
</properties>
@@ -960,7 +961,7 @@
<artifactId>checker-qual</artifactId>
<version>${checker.qual.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-session</artifactId>
@@ -992,6 +993,23 @@
<version>${commons-net.version}</version>
</dependency>
+ <dependency>
+ <groupId>io.jsonwebtoken</groupId>
+ <artifactId>jjwt-api</artifactId>
+ <version>${jwt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.jsonwebtoken</groupId>
+ <artifactId>jjwt-impl</artifactId>
+ <version>${jwt.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.jsonwebtoken</groupId>
+ <artifactId>jjwt-jackson</artifactId>
+ <version>${jwt.version}</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>com.aliyun.datahub</groupId>
<artifactId>aliyun-sdk-datahub</artifactId>
diff --git a/seatunnel-dist/release-docs/LICENSE
b/seatunnel-dist/release-docs/LICENSE
index d717ec093..625748199 100644
--- a/seatunnel-dist/release-docs/LICENSE
+++ b/seatunnel-dist/release-docs/LICENSE
@@ -326,6 +326,9 @@ The text of each license is the standard Apache 2.0 license.
(Apache License 2.0) swagger-annotations
(io.swagger:swagger-annotations:1.5.10 -
https://github.com/swagger-api/swagger-core/modules/swagger-annotations)
(Apache License 2.0) swagger-models (io.swagger:swagger-models:1.5.10 -
https://github.com/swagger-api/swagger-core/modules/swagger-models)
(Apache License 2.0) swagger-models (io.swagger:swagger-models:1.5.10 -
https://github.com/swagger-api/swagger-core/modules/swagger-models)
+ (Apache License 2.0) jjwt (io.jsonwebtoken:jjwt-api:0.10.7 -
https://github.com/jwtk/jjwt)
+ (Apache License 2.0) jjwt (io.jsonwebtoken:impl-:0.10.7 -
https://github.com/jwtk/jjwt)
+ (Apache License 2.0) jjwt (io.jsonwebtoken:jjwt-jackson:0.10.7 -
https://github.com/jwtk/jjwt)
(Apache License Version 2) HikariCP (com.zaxxer:HikariCP:4.0.3 -
https://github.com/brettwooldridge/HikariCP)
(Apache License) HttpClient (commons-httpclient:commons-httpclient:3.1 -
http://jakarta.apache.org/httpcomponents/httpclient-3.x/)
(Apache License) HttpClient (org.apache.httpcomponents:httpclient:4.0.1 -
http://hc.apache.org/httpcomponents-client)
@@ -585,6 +588,7 @@ The text of each license is the standard Apache 2.0 license.
(Apache License, Version 2.0) spring-boot
(org.springframework.boot:spring-boot:2.6.8 -
https://spring.io/projects/spring-boot)
(Apache License, Version 2.0) spring-boot-autoconfigure
(org.springframework.boot:spring-boot-autoconfigure:2.6.8 -
https://spring.io/projects/spring-boot)
(Apache License, Version 2.0) spring-boot-starter
(org.springframework.boot:spring-boot-starter:2.6.8 -
https://spring.io/projects/spring-boot)
+ (Apache License, Version 2.0) spring-boot-starter-aop
(org.springframework.boot:spring-boot-starter-aop:2.6.8 -
https://spring.io/projects/spring-boot)
(Apache License, Version 2.0) spring-boot-starter-jdbc
(org.springframework.boot:spring-boot-starter-jdbc:2.6.3 -
https://spring.io/projects/spring-boot)
(Apache License, Version 2.0) spring-boot-starter-jetty
(org.springframework.boot:spring-boot-starter-jetty:2.6.8 -
https://spring.io/projects/spring-boot)
(Apache License, Version 2.0) spring-boot-starter-json
(org.springframework.boot:spring-boot-starter-json:2.6.8 -
https://spring.io/projects/spring-boot)
@@ -1198,7 +1202,7 @@ The text of each license is also included at
licenses/LICENSE-[project].txt.
(Eclipse Public License, Version 1.0) Aether Utilities
(org.eclipse.aether:aether-util:0.9.0.M2 -
http://www.eclipse.org/aether/aether-util/)
(The Eclipse Public License, Version 1.0) OkHttp Aether Connector
(io.tesla.aether:aether-connector-okhttp:0.0.9 -
http://tesla.io/aether-connector-okhttp)
(The Eclipse Public License, Version 1.0) tesla-aether
(io.tesla.aether:tesla-aether:0.0.5 - http://tesla.io/tesla-aether)
-
+ (Eclipse Public License - v 2.0) aspectjweaver
(org.aspectj:aspectjweaver:1.9.7 - https://github.com/eclipse/org.aspectj/)
========================================================================
Public Domain License
diff --git a/seatunnel-dist/release-docs/licenses/LICENSE-aspectjweaver.txt
b/seatunnel-dist/release-docs/licenses/LICENSE-aspectjweaver.txt
new file mode 100644
index 000000000..4d4254f1d
--- /dev/null
+++ b/seatunnel-dist/release-docs/licenses/LICENSE-aspectjweaver.txt
@@ -0,0 +1,279 @@
+Per: https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+
+Eclipse Public License - v 2.0
+
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial content
+ Distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate from
+ and are Distributed by that particular Contributor. A Contribution
+ "originates" from a Contributor if it was added to the Program by
+ such Contributor itself or anyone acting on such Contributor's behalf.
+ Contributions do not include changes or additions to the Program that
+ are not Modified Works.
+
+"Contributor" means any person or entity that Distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Program" means the Contributions Distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement
+or any Secondary License (as applicable), including Contributors.
+
+"Derivative Works" shall mean any work, whether in Source Code or other
+form, that is based on (or derived from) the Program and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship.
+
+"Modified Works" shall mean any work in Source Code or other form that
+results from an addition to, deletion from, or modification of the
+contents of the Program, including, for purposes of clarity any new file
+in Source Code form that contains any contents of the Program. Modified
+Works shall not include works that contain only declarations,
+interfaces, types, classes, structures, or files of the Program solely
+in each case in order to link to, bind by name, or subclass the Program
+or Modified Works thereof.
+
+"Distribute" means the acts of a) distributing or b) making available
+in any manner that enables the transfer of a copy.
+
+"Source Code" means the form of a Program preferred for making
+modifications, including but not limited to software source code,
+documentation source, and configuration files.
+
+"Secondary License" means either the GNU General Public License,
+Version 2.0, or any later versions of that license, including any
+exceptions or additional permissions as identified by the initial
+Contributor.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare Derivative Works of, publicly display,
+ publicly perform, Distribute and sublicense the Contribution of such
+ Contributor, if any, and such Derivative Works.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in Source Code or other form. This patent license shall
+ apply to the combination of the Contribution and the Program if, at
+ the time the Contribution is added by the Contributor, such addition
+ of the Contribution causes such combination to be covered by the
+ Licensed Patents. The patent license shall not apply to any other
+ combinations which include the Contribution. No hardware per se is
+ licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the
+ rights and licenses granted hereunder, each Recipient hereby
+ assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party
+ patent license is required to allow Recipient to Distribute the
+ Program, it is Recipient's responsibility to acquire that license
+ before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+ e) Notwithstanding the terms of any Secondary License, no
+ Contributor makes additional grants to any Recipient (other than
+ those set forth in this Agreement) as a result of such Recipient's
+ receipt of the Program under the terms of a Secondary License
+ (if permitted under the terms of Section 3).
+
+3. REQUIREMENTS
+
+3.1 If a Contributor Distributes the Program in any form, then:
+
+ a) the Program must also be made available as Source Code, in
+ accordance with section 3.2, and the Contributor must accompany
+ the Program with a statement that the Source Code for the Program
+ is available under this Agreement, and informs Recipients how to
+ obtain it in a reasonable manner on or through a medium customarily
+ used for software exchange; and
+
+ b) the Contributor may Distribute the Program under a license
+ different than this Agreement, provided that such license:
+ i) effectively disclaims on behalf of all other Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+
+ ii) effectively excludes on behalf of all other Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+
+ iii) does not attempt to limit or alter the recipients' rights
+ in the Source Code under section 3.2; and
+
+ iv) requires any subsequent distribution of the Program by any
+ party to be under a license that satisfies the requirements
+ of this section 3.
+
+3.2 When the Program is Distributed as Source Code:
+
+ a) it must be made available under this Agreement, or if the
+ Program (i) is combined with other material in a separate file or
+ files made available under a Secondary License, and (ii) the initial
+ Contributor attached to the Source Code the notice described in
+ Exhibit A of this Agreement, then the Program may be made available
+ under the terms of such Secondary Licenses, and
+
+ b) a copy of this Agreement must be included with each copy of
+ the Program.
+
+3.3 Contributors may not remove or alter any copyright, patent,
+trademark, attribution notices, disclaimers of warranty, or limitations
+of liability ("notices") contained within the Program from any copy of
+the Program which they Distribute, provided that Contributors may add
+their own appropriate notices.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program,
+the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes
+the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every
+other Contributor ("Indemnified Contributor") against any losses,
+damages and costs (collectively "Losses") arising from claims, lawsuits
+and other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program
+in a commercial product offering. The obligations in this section do not
+apply to any claims or Losses relating to any actual or alleged
+intellectual property infringement. In order to qualify, an Indemnified
+Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control,
+and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay
+those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
+TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all
+risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs
+or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
+SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software
+or hardware) infringes such Recipient's patent(s), then such Recipient's
+rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign the
+responsibility to serve as the Agreement Steward to a suitable separate
+entity. Each new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+Distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to Distribute the Program (including its
+Contributions) under the new version.
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
+receives no rights or licenses to the intellectual property of any
+Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted
+under this Agreement are reserved. Nothing in this Agreement is intended
+to be enforceable by any entity that is not a Contributor or Recipient.
+No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A - Form of Secondary Licenses Notice
+
+"This Source Code may also be made available under the following
+Secondary Licenses when the conditions for such availability set forth
+in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
+version(s), and exceptions or additional permissions here}."
+
+ Simply including a copy of this Agreement, including this Exhibit A
+ is not sufficient to license the Source Code under Secondary Licenses.
+
+ If it is not possible or desirable to put the notice in a particular
+ file, then You may include the notice in a location (such as a LICENSE
+ file in a relevant directory) where a recipient would be likely to
+ look for such a notice.
+
+ You may add additional accurate notices of copyright ownership.
\ No newline at end of file
diff --git a/seatunnel-server/seatunnel-app/pom.xml
b/seatunnel-server/seatunnel-app/pom.xml
index b9d4c84fd..8d6c821dc 100644
--- a/seatunnel-server/seatunnel-app/pom.xml
+++ b/seatunnel-server/seatunnel-app/pom.xml
@@ -153,6 +153,25 @@
<artifactId>seatunnel-scheduler-dolphinscheduler</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>io.jsonwebtoken</groupId>
+ <artifactId>jjwt-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.jsonwebtoken</groupId>
+ <artifactId>jjwt-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.jsonwebtoken</groupId>
+ <artifactId>jjwt-jackson</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-aop</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
</dependencies>
<build>
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/adapter/SeatunnelWebAdapter.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/adapter/SeatunnelWebAdapter.java
new file mode 100644
index 000000000..9f1d4ab0f
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/adapter/SeatunnelWebAdapter.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.app.adapter;
+
+import org.apache.seatunnel.app.interceptor.AuthenticationInterceptor;
+import org.apache.seatunnel.app.resolver.UserIdMethodArgumentResolver;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import javax.annotation.Resource;
+
+import java.util.List;
+
+@Configuration
+public class SeatunnelWebAdapter implements WebMvcConfigurer {
+ @Bean
+ public AuthenticationInterceptor authenticationInterceptor() {
+ return new AuthenticationInterceptor();
+ }
+
+ @Resource
+ private UserIdMethodArgumentResolver currentUserMethodArgumentResolver;
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+
registry.addInterceptor(authenticationInterceptor()).order(1).addPathPatterns("/**")
+ // exclude swagger api path
+ .excludePathPatterns(
+ "/swagger-resources/**",
+ "/webjars/**",
+ "/v2/**",
+ "/swagger-ui.html**"
+ )
+ // exclude login
+ .excludePathPatterns("/api/v1/user/login**")
+ ;
+ }
+
+ @Override
+ public void addArgumentResolvers(List<HandlerMethodArgumentResolver>
argumentResolvers) {
+ argumentResolvers.add(currentUserMethodArgumentResolver);
+ }
+}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/LoginAspect.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/LoginAspect.java
new file mode 100644
index 000000000..1bba7f74a
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/LoginAspect.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.app.aspect;
+
+import static org.apache.seatunnel.server.common.Constants.TOKEN;
+
+import org.apache.seatunnel.app.common.Result;
+import org.apache.seatunnel.app.common.UserTokenStatusEnum;
+import org.apache.seatunnel.app.dal.dao.IUserDao;
+import org.apache.seatunnel.app.domain.dto.user.UserLoginLogDto;
+import org.apache.seatunnel.app.domain.response.user.UserSimpleInfoRes;
+import org.apache.seatunnel.app.security.JwtUtils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+@Aspect
+@Component
+@Order(2)
+public class LoginAspect {
+ @Resource
+ private JwtUtils jwtUtils;
+
+ @Resource
+ private IUserDao userDaoImpl;
+
+ @Pointcut("execution(public *
org.apache.seatunnel.app.controller.UserController.login(..))")
+ public void loginPointCut() {
+
+ }
+
+ @AfterReturning(value = "loginPointCut()", returning = "obj")
+ public void check(JoinPoint pjp, Object obj) {
+ final Result<UserSimpleInfoRes> target = (Result<UserSimpleInfoRes>)
obj;
+ final UserSimpleInfoRes data = target.getData();
+
+ ServletRequestAttributes attributes = (ServletRequestAttributes)
RequestContextHolder.getRequestAttributes();
+ final HttpServletResponse response = attributes.getResponse();
+ final String token = jwtUtils.genToken(data.toMap());
+ response.setHeader(TOKEN, token);
+
+ final UserLoginLogDto logDto = UserLoginLogDto.builder()
+ .token(token)
+ .tokenStatus(UserTokenStatusEnum.ENABLE.enable())
+ .userId(data.getId())
+ .build();
+ userDaoImpl.insertLoginLog(logDto);
+ }
+}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/LogoutAspect.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/LogoutAspect.java
new file mode 100644
index 000000000..3d481c2f5
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/LogoutAspect.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.app.aspect;
+
+import static org.apache.seatunnel.server.common.Constants.USER_ID;
+
+import org.apache.seatunnel.app.dal.dao.IUserDao;
+
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+@Slf4j
+@Aspect
+@Component
+@Order(2)
+public class LogoutAspect {
+
+ @Resource
+ private IUserDao userDaoImpl;
+
+ @Pointcut("execution(public *
org.apache.seatunnel.app.controller.UserController.logout(..))")
+ public void logoutPointCut() {
+
+ }
+
+ @Before("logoutPointCut()")
+ public void check(JoinPoint pjp) {
+ ServletRequestAttributes attributes = (ServletRequestAttributes)
RequestContextHolder.getRequestAttributes();
+ HttpServletRequest request = attributes.getRequest();
+ final Integer userId = (Integer) request.getAttribute(USER_ID);
+ userDaoImpl.disableToken(userId);
+ }
+}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/UserId.java
similarity index 73%
copy from
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
copy to
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/UserId.java
index 3c18064ed..628e103ca 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/aspect/UserId.java
@@ -15,10 +15,14 @@
* limitations under the License.
*/
-package org.apache.seatunnel.app.domain.response.user;
+package org.apache.seatunnel.app.aspect;
-import io.swagger.annotations.ApiModel;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
-@ApiModel(value = "userSimpleInfoRes", description = "user simple information")
-public class UserSimpleInfoRes extends BaseUserInfoRes{
+@Target({ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UserId {
}
diff --git
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/common/UserTokenStatusEnum.java
similarity index 79%
copy from
seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
copy to
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/common/UserTokenStatusEnum.java
index 000bb3077..502a9647a 100644
---
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/common/UserTokenStatusEnum.java
@@ -15,10 +15,14 @@
* limitations under the License.
*/
-package org.apache.seatunnel.server.common;
+package org.apache.seatunnel.app.common;
-public class Constants {
- public static final String BLANK_SPACE = " ";
- public static final String COMMA = ",";
- public static final String UNDERLINE = "_";
+public enum UserTokenStatusEnum {
+ ENABLE,
+ DISABLE,
+ ;
+
+ public boolean enable() {
+ return this == ENABLE;
+ }
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/config/Swagger2.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/config/Swagger2.java
index f8a5718da..3eb93a856 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/config/Swagger2.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/config/Swagger2.java
@@ -17,14 +17,8 @@
package org.apache.seatunnel.app.config;
-import com.fasterxml.classmate.TypeResolver;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
-import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import
org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@@ -35,11 +29,7 @@ import
springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
-@EnableWebMvc
-public class Swagger2 implements WebMvcConfigurer {
- @Autowired
- private TypeResolver typeResolver;
-
+public class Swagger2{
@Bean
public Docket createRestApi() {
@@ -49,30 +39,6 @@ public class Swagger2 implements WebMvcConfigurer {
.apis(RequestHandlerSelectors.basePackage("org.apache.seatunnel.app.controller"))
.paths(PathSelectors.any())
.build();
-
- }
-
- @Override
- public void addViewControllers(ViewControllerRegistry registry) {
- registry.addRedirectViewController("/api/v2/api-docs", "/v2/api-docs");
-
registry.addRedirectViewController("/api/swagger-resources/configuration/ui",
"/swagger-resources/configuration/ui");
-
registry.addRedirectViewController("/api/swagger-resources/configuration/security",
"/swagger-resources/configuration/security");
- registry.addRedirectViewController("/api/swagger-resources",
"/swagger-resources");
-
- registry.addRedirectViewController("/api/null/api-docs",
- "/api-docs").setKeepQueryParams(true);
-
registry.addRedirectViewController("/api/null/swagger-resources/configuration/ui",
- "/swagger-resources/configuration/ui");
-
registry.addRedirectViewController("/api/null/swagger-resources/configuration/security",
- "/swagger-resources/configuration/security");
- registry.addRedirectViewController("/api/null/swagger-resources",
"/swagger-resources");
- }
-
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
-
registry.addResourceHandler("/api/swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
-
registry.addResourceHandler("/api/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
-
registry.addResourceHandler("/doc.html**").addResourceLocations("classpath:/META-INF/resources/");
}
private ApiInfo apiInfo() {
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/controller/UserController.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/controller/UserController.java
index d7cf924d2..feb8b460c 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/controller/UserController.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/controller/UserController.java
@@ -21,6 +21,7 @@ import org.apache.seatunnel.app.common.Result;
import org.apache.seatunnel.app.domain.request.user.AddUserReq;
import org.apache.seatunnel.app.domain.request.user.UpdateUserReq;
import org.apache.seatunnel.app.domain.request.user.UserListReq;
+import org.apache.seatunnel.app.domain.request.user.UserLoginReq;
import org.apache.seatunnel.app.domain.response.PageInfo;
import org.apache.seatunnel.app.domain.response.user.AddUserRes;
import org.apache.seatunnel.app.domain.response.user.UserSimpleInfoRes;
@@ -30,6 +31,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -95,4 +97,14 @@ public class UserController {
iUserService.disable(id);
return Result.success();
}
+
+ @PostMapping("/login")
+ public Result<UserSimpleInfoRes> login(@RequestBody UserLoginReq req) {
+ return Result.success(iUserService.login(req));
+ }
+
+ @PatchMapping("/logout")
+ public Result<Void> logout() {
+ return Result.success();
+ }
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/IUserDao.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/IUserDao.java
index ebf1d19c0..db2f16623 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/IUserDao.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/IUserDao.java
@@ -18,8 +18,10 @@
package org.apache.seatunnel.app.dal.dao;
import org.apache.seatunnel.app.dal.entity.User;
+import org.apache.seatunnel.app.dal.entity.UserLoginLog;
import org.apache.seatunnel.app.domain.dto.user.ListUserDto;
import org.apache.seatunnel.app.domain.dto.user.UpdateUserDto;
+import org.apache.seatunnel.app.domain.dto.user.UserLoginLogDto;
import org.apache.seatunnel.server.common.PageData;
public interface IUserDao {
@@ -40,4 +42,12 @@ public interface IUserDao {
User getById(int operatorId);
User getByName(String user);
+
+ User checkPassword(String username, String password);
+
+ long insertLoginLog(UserLoginLogDto dto);
+
+ void disableToken(int userId);
+
+ UserLoginLog getLastLoginLog(Integer userId);
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/UserDaoImpl.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/UserDaoImpl.java
index 8af3d8e52..a94ee5eac 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/UserDaoImpl.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/UserDaoImpl.java
@@ -22,11 +22,15 @@ import static
org.apache.seatunnel.server.common.SeatunnelErrorEnum.USER_ALREADY
import static com.google.common.base.Preconditions.checkState;
import org.apache.seatunnel.app.common.UserStatusEnum;
+import org.apache.seatunnel.app.common.UserTokenStatusEnum;
import org.apache.seatunnel.app.dal.dao.IUserDao;
import org.apache.seatunnel.app.dal.entity.User;
+import org.apache.seatunnel.app.dal.entity.UserLoginLog;
+import org.apache.seatunnel.app.dal.mapper.UserLoginLogMapper;
import org.apache.seatunnel.app.dal.mapper.UserMapper;
import org.apache.seatunnel.app.domain.dto.user.ListUserDto;
import org.apache.seatunnel.app.domain.dto.user.UpdateUserDto;
+import org.apache.seatunnel.app.domain.dto.user.UserLoginLogDto;
import org.apache.seatunnel.server.common.PageData;
import org.springframework.stereotype.Repository;
@@ -40,6 +44,8 @@ import java.util.Objects;
public class UserDaoImpl implements IUserDao {
@Resource
private UserMapper userMapper;
+ @Resource
+ private UserLoginLogMapper userLoginLogMapper;
@Override
public int add(UpdateUserDto dto) {
@@ -106,4 +112,30 @@ public class UserDaoImpl implements IUserDao {
public User getByName(String user) {
return userMapper.selectByName(user);
}
+
+ @Override
+ public User checkPassword(String username, String password) {
+ return userMapper.selectByNameAndPasswd(username, password);
+ }
+
+ @Override
+ public long insertLoginLog(UserLoginLogDto dto) {
+ final UserLoginLog log = new UserLoginLog();
+ log.setToken(dto.getToken());
+ log.setTokenStatus(dto.getTokenStatus());
+ log.setUserId(dto.getUserId());
+
+ userLoginLogMapper.insert(log);
+ return log.getId();
+ }
+
+ @Override
+ public void disableToken(int userId) {
+ userLoginLogMapper.updateStatus(userId,
UserTokenStatusEnum.DISABLE.enable());
+ }
+
+ @Override
+ public UserLoginLog getLastLoginLog(Integer userId) {
+ return userLoginLogMapper.checkLastTokenEnable(userId);
+ }
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/entity/UserLoginLog.java
similarity index 73%
copy from
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
copy to
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/entity/UserLoginLog.java
index 3c18064ed..008d46d76 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/entity/UserLoginLog.java
@@ -15,10 +15,23 @@
* limitations under the License.
*/
-package org.apache.seatunnel.app.domain.response.user;
+package org.apache.seatunnel.app.dal.entity;
-import io.swagger.annotations.ApiModel;
+import lombok.Data;
-@ApiModel(value = "userSimpleInfoRes", description = "user simple information")
-public class UserSimpleInfoRes extends BaseUserInfoRes{
+import java.util.Date;
+
+@Data
+public class UserLoginLog {
+ private Long id;
+
+ private Integer userId;
+
+ private String token;
+
+ private Boolean tokenStatus;
+
+ private Date createTime;
+
+ private Date updateTime;
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserLoginLogMapper.java
similarity index 67%
copy from
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
copy to
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserLoginLogMapper.java
index 3c18064ed..448011691 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserLoginLogMapper.java
@@ -15,10 +15,20 @@
* limitations under the License.
*/
-package org.apache.seatunnel.app.domain.response.user;
+package org.apache.seatunnel.app.dal.mapper;
-import io.swagger.annotations.ApiModel;
+import org.apache.seatunnel.app.dal.entity.UserLoginLog;
-@ApiModel(value = "userSimpleInfoRes", description = "user simple information")
-public class UserSimpleInfoRes extends BaseUserInfoRes{
+import org.apache.ibatis.annotations.Param;
+
+public interface UserLoginLogMapper {
+ int insert(UserLoginLog userLoginLog);
+
+ int updateStatus(@Param("userId") int userId, @Param("enable") boolean
enable);
+
+ UserLoginLog checkLastTokenEnable(@Param("userId") Integer userId);
}
+
+
+
+
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserMapper.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserMapper.java
index 5d0cbae25..3bd74f226 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserMapper.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/mapper/UserMapper.java
@@ -39,4 +39,6 @@ public interface UserMapper {
User selectByName(@Param("username") String username);
int countBySelective(@Param("user") User user);
+
+ User selectByNameAndPasswd(@Param("username") String username,
@Param("password") String password);
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/dto/user/UserLoginLogDto.java
similarity index 76%
copy from
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
copy to
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/dto/user/UserLoginLogDto.java
index 3c18064ed..55af565c7 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/dto/user/UserLoginLogDto.java
@@ -15,10 +15,19 @@
* limitations under the License.
*/
-package org.apache.seatunnel.app.domain.response.user;
+package org.apache.seatunnel.app.domain.dto.user;
-import io.swagger.annotations.ApiModel;
+import lombok.Builder;
+import lombok.Data;
-@ApiModel(value = "userSimpleInfoRes", description = "user simple information")
-public class UserSimpleInfoRes extends BaseUserInfoRes{
+@Data
+@Builder
+public class UserLoginLogDto {
+ private Long id;
+
+ private Integer userId;
+
+ private String token;
+
+ private Boolean tokenStatus;
}
diff --git
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/request/user/UserLoginReq.java
similarity index 79%
copy from
seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
copy to
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/request/user/UserLoginReq.java
index 000bb3077..fdf2cd3f7 100644
---
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/request/user/UserLoginReq.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
-package org.apache.seatunnel.server.common;
+package org.apache.seatunnel.app.domain.request.user;
-public class Constants {
- public static final String BLANK_SPACE = " ";
- public static final String COMMA = ",";
- public static final String UNDERLINE = "_";
+import lombok.Data;
+
+@Data
+public class UserLoginReq {
+ private String username;
+ private String password;
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
index 3c18064ed..b1c6af20e 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/user/UserSimpleInfoRes.java
@@ -17,8 +17,21 @@
package org.apache.seatunnel.app.domain.response.user;
+import com.google.common.collect.Maps;
import io.swagger.annotations.ApiModel;
+import java.util.HashMap;
+import java.util.Map;
+
@ApiModel(value = "userSimpleInfoRes", description = "user simple information")
-public class UserSimpleInfoRes extends BaseUserInfoRes{
+public class UserSimpleInfoRes extends BaseUserInfoRes {
+
+ public Map<String, Object> toMap() {
+ final HashMap<String, Object> userMap = Maps.newHashMap();
+ userMap.put("id", getId());
+ userMap.put("name", getName());
+ userMap.put("status", getStatus());
+ userMap.put("type", getType());
+ return userMap;
+ }
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/interceptor/AuthenticationInterceptor.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/interceptor/AuthenticationInterceptor.java
new file mode 100644
index 000000000..3b4326256
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/interceptor/AuthenticationInterceptor.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.app.interceptor;
+
+import static org.apache.seatunnel.server.common.Constants.OPTIONS;
+import static org.apache.seatunnel.server.common.Constants.TOKEN;
+import static org.apache.seatunnel.server.common.Constants.USER_ID;
+import static
org.apache.seatunnel.server.common.SeatunnelErrorEnum.TOKEN_ILLEGAL;
+import static io.jsonwebtoken.Claims.EXPIRATION;
+
+import org.apache.seatunnel.app.dal.dao.IUserDao;
+import org.apache.seatunnel.app.dal.entity.UserLoginLog;
+import org.apache.seatunnel.app.security.JwtUtils;
+import org.apache.seatunnel.server.common.SeatunnelException;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import java.util.Map;
+import java.util.Objects;
+
+@Slf4j
+public class AuthenticationInterceptor implements HandlerInterceptor {
+
+ @Resource
+ private IUserDao userDaoImpl;
+
+ @Resource
+ private JwtUtils jwtUtils;
+
+ @Override
+ @SuppressWarnings("MagicNumber")
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse
response, Object handler) throws Exception {
+ if (request.getMethod().equals(OPTIONS)) {
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Headers", "*");
+ response.setHeader("Access-Control-Allow-Methods", "*");
+ response.setHeader("Access-Control-Allow-Credentials", "true");
+ response.setHeader("Access-Control-Max-Age", "3600");
+ return true;
+ }
+ long currentTimestamp = System.currentTimeMillis();
+ final String token = request.getHeader(TOKEN);
+ if (StringUtils.isBlank(token)) {
+ throw new SeatunnelException(TOKEN_ILLEGAL);
+ }
+ final Map<String, Object> map = jwtUtils.parseToken(token);
+ final Integer userId = (Integer) map.get(USER_ID);
+ if (Objects.isNull(userId)) {
+ throw new SeatunnelException(TOKEN_ILLEGAL);
+ }
+ final UserLoginLog userLoginLog = userDaoImpl.getLastLoginLog(userId);
+ if (Objects.isNull(userLoginLog) || !userLoginLog.getTokenStatus()) {
+ throw new SeatunnelException(TOKEN_ILLEGAL);
+ }
+
+ final Integer expireDate = (Integer) map.get(EXPIRATION);
+ if (Objects.isNull(expireDate) || currentTimestamp - (long) expireDate
* 1000 > 0) {
+ throw new SeatunnelException(TOKEN_ILLEGAL);
+ }
+
+ map.forEach(request::setAttribute);
+
+ return true;
+ }
+
+ @Override
+ public void postHandle(HttpServletRequest request, HttpServletResponse
response, Object handler, ModelAndView modelAndView) throws Exception {
+ // do nothing
+ }
+
+ @Override
+ public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) throws Exception {
+ // do nothing
+ }
+}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/resolver/UserIdMethodArgumentResolver.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/resolver/UserIdMethodArgumentResolver.java
new file mode 100644
index 000000000..3ebfca7af
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/resolver/UserIdMethodArgumentResolver.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.app.resolver;
+
+import static org.apache.seatunnel.server.common.Constants.USER_ID;
+
+import org.apache.seatunnel.app.aspect.UserId;
+
+import org.springframework.core.MethodParameter;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.support.WebDataBinderFactory;
+import org.springframework.web.context.request.NativeWebRequest;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.method.support.ModelAndViewContainer;
+
+@Component
+public class UserIdMethodArgumentResolver implements
HandlerMethodArgumentResolver {
+ @Override
+ public boolean supportsParameter(MethodParameter parameter) {
+ return parameter.getParameterType().isAssignableFrom(Integer.class)
+ && parameter.hasParameterAnnotation(UserId.class);
+ }
+
+ @Override
+ public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
+ return (Integer) webRequest.getAttribute(USER_ID,
RequestAttributes.SCOPE_REQUEST);
+ }
+
+}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/security/JwtUtils.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/security/JwtUtils.java
new file mode 100644
index 000000000..9ddc9b40f
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/security/JwtUtils.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.app.security;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jws;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import org.apache.commons.lang3.time.DateUtils;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+@Component
+public class JwtUtils implements InitializingBean {
+ @Value("${jwt.expireTime}")
+ private int expireTime;
+ @Value("${jwt.secretKey}")
+ private String secretKey;
+ @Value("${jwt.algorithm}")
+ private String algorithmString;
+ private SignatureAlgorithm algorithm = null;
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ algorithm = SignatureAlgorithm.valueOf(algorithmString);
+ }
+
+ public String genToken(Map<String, Object> data) {
+ final Date currentDate = new Date();
+ final Date expireDate = DateUtils.addSeconds(currentDate, expireTime);
+
+ return Jwts.builder()
+ .signWith(SignatureAlgorithm.HS256,
secretKey.getBytes(StandardCharsets.UTF_8))
+ .setId(UUID.randomUUID().toString())
+ .setClaims(data)
+ .setIssuedAt(currentDate)
+ .setExpiration(expireDate)
+ .compact();
+ }
+
+ public Map<String, Object> parseToken(String token) {
+ final Jws<Claims> claims =
Jwts.parser().setSigningKey(secretKey.getBytes(StandardCharsets.UTF_8)).parseClaimsJws(token);
+ return claims.getBody();
+ }
+}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/IUserService.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/IUserService.java
index 54f56f0d9..60ba8d430 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/IUserService.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/IUserService.java
@@ -20,6 +20,7 @@ package org.apache.seatunnel.app.service;
import org.apache.seatunnel.app.domain.request.user.AddUserReq;
import org.apache.seatunnel.app.domain.request.user.UpdateUserReq;
import org.apache.seatunnel.app.domain.request.user.UserListReq;
+import org.apache.seatunnel.app.domain.request.user.UserLoginReq;
import org.apache.seatunnel.app.domain.response.PageInfo;
import org.apache.seatunnel.app.domain.response.user.AddUserRes;
import org.apache.seatunnel.app.domain.response.user.UserSimpleInfoRes;
@@ -37,4 +38,6 @@ public interface IUserService {
void enable(int id);
void disable(int id);
+
+ UserSimpleInfoRes login(UserLoginReq req);
}
diff --git
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/UserServiceImpl.java
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/UserServiceImpl.java
index db34ce159..377866b2e 100644
---
a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/UserServiceImpl.java
+++
b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/UserServiceImpl.java
@@ -17,6 +17,8 @@
package org.apache.seatunnel.app.service.impl;
+import static
org.apache.seatunnel.server.common.SeatunnelErrorEnum.USERNAME_PASSWORD_NO_MATCHED;
+
import org.apache.seatunnel.app.dal.dao.IUserDao;
import org.apache.seatunnel.app.dal.entity.User;
import org.apache.seatunnel.app.domain.dto.user.ListUserDto;
@@ -24,6 +26,7 @@ import org.apache.seatunnel.app.domain.dto.user.UpdateUserDto;
import org.apache.seatunnel.app.domain.request.user.AddUserReq;
import org.apache.seatunnel.app.domain.request.user.UpdateUserReq;
import org.apache.seatunnel.app.domain.request.user.UserListReq;
+import org.apache.seatunnel.app.domain.request.user.UserLoginReq;
import org.apache.seatunnel.app.domain.response.PageInfo;
import org.apache.seatunnel.app.domain.response.user.AddUserRes;
import org.apache.seatunnel.app.domain.response.user.UserSimpleInfoRes;
@@ -31,6 +34,7 @@ import org.apache.seatunnel.app.service.IRoleService;
import org.apache.seatunnel.app.service.IUserService;
import org.apache.seatunnel.app.util.PasswordUtils;
import org.apache.seatunnel.server.common.PageData;
+import org.apache.seatunnel.server.common.SeatunnelException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -39,6 +43,7 @@ import
org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
+import java.util.Objects;
import java.util.stream.Collectors;
@Component
@@ -127,6 +132,19 @@ public class UserServiceImpl implements IUserService {
userDaoImpl.disable(id);
}
+ @Override
+ public UserSimpleInfoRes login(UserLoginReq req) {
+
+ final String username = req.getUsername();
+ final String password = PasswordUtils.encryptWithSalt(defaultSalt,
req.getPassword());
+
+ final User user = userDaoImpl.checkPassword(username, password);
+ if (Objects.isNull(user)) {
+ throw new SeatunnelException(USERNAME_PASSWORD_NO_MATCHED);
+ }
+ return translate(user);
+ }
+
private UserSimpleInfoRes translate(User user) {
final UserSimpleInfoRes info = new UserSimpleInfoRes();
info.setId(user.getId());
diff --git a/seatunnel-server/seatunnel-app/src/main/resources/application.yml
b/seatunnel-server/seatunnel-app/src/main/resources/application.yml
index 0c62be516..1d05098d6 100644
--- a/seatunnel-server/seatunnel-app/src/main/resources/application.yml
+++ b/seatunnel-server/seatunnel-app/src/main/resources/application.yml
@@ -22,4 +22,22 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
url:
jdbc:mysql://127.0.0.1:3306/seatunnel?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
username: root
- password: 123456
\ No newline at end of file
+ password: 123456
+ mvc:
+ pathmatch:
+ matching-strategy: ant_path_matcher
+ds:
+ script:
+ dir: /dj
+ project:
+ default: test_dj
+ tenant:
+ default: default
+ api:
+ token: 12345678
+ prefix: http://127.0.0.1:12345/dolphinscheduler
+
+jwt:
+ expireTime: 86400
+ secretKey: https://github.com/apache/incubator-seatunnel
+ algorithm: HS256
\ No newline at end of file
diff --git
a/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserLoginLogMapper.xml
b/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserLoginLogMapper.xml
new file mode 100644
index 000000000..f8f944421
--- /dev/null
+++
b/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserLoginLogMapper.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.seatunnel.app.dal.mapper.UserLoginLogMapper">
+
+ <resultMap id="BaseResultMap"
type="org.apache.seatunnel.app.dal.entity.UserLoginLog">
+ <id property="id" column="id" jdbcType="BIGINT"/>
+ <result property="userId" column="user_id" jdbcType="INTEGER"/>
+ <result property="token" column="token" jdbcType="VARCHAR"/>
+ <result property="tokenStatus" column="token_status"
jdbcType="BOOLEAN"/>
+ <result property="createTime" column="create_time"
jdbcType="TIMESTAMP"/>
+ <result property="updateTime" column="update_time"
jdbcType="TIMESTAMP"/>
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ id,
+ user_id,
+ token,
+ token_status,
+ create_time,
+ update_time
+ </sql>
+
+ <insert id="insert" keyColumn="id" keyProperty="id"
parameterType="org.apache.seatunnel.app.dal.entity.UserLoginLog"
+ useGeneratedKeys="true">
+ insert into `user_login_log` (user_id, token, `token_status`)
+ VALUES (#{userId,jdbcType=INTEGER}, #{token,jdbcType=VARCHAR},
#{tokenStatus,jdbcType=BOOLEAN})
+ </insert>
+
+ <update id="updateStatus">
+ update user_login_log
+ set token_status = #{enable,jdbcType=BOOLEAN}
+ where user_id = #{userId,jdbcType=INTEGER} and token_status !=
#{enable}
+ </update>
+ <select id="checkLastTokenEnable" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from user_login_log
+ where user_id = #{userId,jdbcType=INTEGER}
+ order by id desc
+ limit 1
+ </select>
+</mapper>
diff --git
a/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserMapper.xml
b/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserMapper.xml
index 070729e84..1c22238b8 100644
---
a/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserMapper.xml
+++
b/seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/UserMapper.xml
@@ -90,4 +90,10 @@
</if>
</where>
</select>
+ <select id="selectByNameAndPasswd"
resultType="org.apache.seatunnel.app.dal.entity.User">
+ select
+ <include refid="Base_Column_List"/>
+ from `user`
+ where username = #{username,jdbcType=VARCHAR} and password =
#{password,jdbcType=VARCHAR}
+ </select>
</mapper>
diff --git
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
b/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
index 000bb3077..f55aa89d2 100644
---
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
+++
b/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/Constants.java
@@ -21,4 +21,8 @@ public class Constants {
public static final String BLANK_SPACE = " ";
public static final String COMMA = ",";
public static final String UNDERLINE = "_";
+ public static final String TOKEN = "token";
+ public static final String USER_ID = "id";
+
+ public static final String OPTIONS = "OPTIONS";
}
diff --git
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/SeatunnelErrorEnum.java
b/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/SeatunnelErrorEnum.java
index db3fce8e4..9e9f494ec 100644
---
a/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/SeatunnelErrorEnum.java
+++
b/seatunnel-server/seatunnel-server-common/src/main/java/org/apache/seatunnel/server/common/SeatunnelErrorEnum.java
@@ -22,9 +22,13 @@ public enum SeatunnelErrorEnum {
SCRIPT_ALREADY_EXIST(10001, "script already exist", "You already have a
script with the same name : '%s'"),
NO_SUCH_SCRIPT(10002, "no such script", "No such script. Maybe deleted by
others."),
USER_ALREADY_EXISTS(10003, "user already exist", "The same username [%s]
is exist."),
- NO_SUCH_USER(10002, "no such user", "No such user. Maybe deleted by
others."),
- SCHEDULER_CONFIG_NOT_EXIST(10003, "scheduler config not exist", "This
script's scheduler config not exist, please check your config."),
- JSON_TRANSFORM_FAILED(10004, "json transform failed", "Json transform
failed, it may be a bug."),
+ NO_SUCH_USER(10004, "no such user", "No such user. Maybe deleted by
others."),
+ SCHEDULER_CONFIG_NOT_EXIST(10005, "scheduler config not exist", "This
script's scheduler config not exist, please check your config."),
+ JSON_TRANSFORM_FAILED(10006, "json transform failed", "Json transform
failed, it may be a bug."),
+
+ USERNAME_PASSWORD_NO_MATCHED(10007, "username and password no matched",
"The user name and password do not match, please check your input"),
+
+ TOKEN_ILLEGAL(10008, "token illegal", "The token is expired or invalid,
please login again."),
/**
* request dolphinscheduler failed
diff --git a/tools/dependencies/known-dependencies.txt
b/tools/dependencies/known-dependencies.txt
index 8f578303e..af1a6847d 100755
--- a/tools/dependencies/known-dependencies.txt
+++ b/tools/dependencies/known-dependencies.txt
@@ -35,6 +35,7 @@ asm-all-5.0.2.jar
asm-analysis-7.1.jar
asm-commons-7.1.jar
asm-tree-7.1.jar
+aspectjweaver-1.9.7.jar
async-http-client-2.5.3.jar
async-http-client-netty-utils-2.5.3.jar
audience-annotations-0.11.0.jar
@@ -431,6 +432,9 @@ jsr305-1.3.9.jar
jsr305-2.0.1.jar
jsr311-api-1.1.1.jar
jvm-attach-api-1.5.jar
+jjwt-api-0.10.7.jar
+jjwt-impl-0.10.7.jar
+jjwt-jackson-0.10.7.jar
kafka-clients-2.0.0.jar
kafka-clients-2.4.1.jar
kerb-admin-1.0.1.jar
@@ -657,6 +661,7 @@ spring-beans-5.3.20.jar
spring-boot-2.6.8.jar
spring-boot-autoconfigure-2.6.8.jar
spring-boot-starter-2.6.8.jar
+spring-boot-starter-aop-2.6.8.jar
spring-boot-starter-jdbc-2.6.3.jar
spring-boot-starter-jetty-2.6.8.jar
spring-boot-starter-json-2.6.8.jar