mirror of
https://github.com/dataease/dataease.git
synced 2026-05-19 10:18:11 +08:00
feat(X-Pack): 新增oauth2认证 #11745
This commit is contained in:
@@ -34,6 +34,9 @@ public interface XpackAuthenticationApi {
|
||||
@PostMapping("/save/ldap")
|
||||
String saveLdap(@RequestBody XpackLdapVO editor);
|
||||
|
||||
@PostMapping("/save/oauth2")
|
||||
String saveOauth2(@RequestBody XpackOauth2VO editor);
|
||||
|
||||
|
||||
@GetMapping("/info/oidc")
|
||||
XpackOidcVO oidcInfo();
|
||||
@@ -44,6 +47,9 @@ public interface XpackAuthenticationApi {
|
||||
@GetMapping("/info/ldap")
|
||||
XpackLdapVO ldapInfo();
|
||||
|
||||
@GetMapping("/info/oauth2")
|
||||
XpackOauth2VO oauth2Info();
|
||||
|
||||
|
||||
@PostMapping("/validate/oidc")
|
||||
String validateOidc(@RequestBody XpackOidcVO editor);
|
||||
@@ -54,10 +60,14 @@ public interface XpackAuthenticationApi {
|
||||
@PostMapping("/validate/ldap")
|
||||
String validateLdap(@RequestBody XpackLdapVO editor);
|
||||
|
||||
@PostMapping("/validate/oauth2")
|
||||
String validateOauth2(@RequestBody XpackOauth2VO editor);
|
||||
|
||||
@PostMapping("/validateId/{id}")
|
||||
String validate(@PathVariable("id") Long id);
|
||||
|
||||
@Operation(summary = "查询状态")
|
||||
@GetMapping("/status")
|
||||
List<XpackAuthenticationStatusVO> status();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package io.dataease.api.xpack.settings;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.api.xpack.settings.request.XpackOauth2TokenRequest;
|
||||
import io.dataease.api.xpack.settings.vo.XpackOauthAuthVO;
|
||||
import io.dataease.api.xpack.settings.vo.XpackOauthTokenVO;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@Tag(name = "Oauth2认证")
|
||||
@ApiSupport(order = 899)
|
||||
public interface XpackOauth2Api {
|
||||
|
||||
@GetMapping("/auth")
|
||||
XpackOauthAuthVO auth();
|
||||
|
||||
@PostMapping("/token")
|
||||
XpackOauthTokenVO oauth2Token(@RequestBody XpackOauth2TokenRequest request);
|
||||
|
||||
@GetMapping("/logout/{idToken}")
|
||||
void logout(@PathVariable("idToken") String idToken);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.dataease.api.xpack.settings.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class XpackOauth2TokenRequest implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 489213446985742448L;
|
||||
|
||||
private String code;
|
||||
|
||||
private String state;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.dataease.api.xpack.settings.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class XpackOauth2VO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 2395518228048236146L;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String clientSecret;
|
||||
|
||||
private String authEndpoint;
|
||||
|
||||
private String tokenEndpoint;
|
||||
|
||||
private String userInfoEndpoint;
|
||||
|
||||
private String logoutEndpoint;
|
||||
|
||||
private String scope;
|
||||
|
||||
private String mapping;
|
||||
|
||||
private String redirectUri;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.dataease.api.xpack.settings.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class XpackOauthAuthVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3658093847024323465L;
|
||||
|
||||
private String state;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String redirectUri;
|
||||
|
||||
private String authEndpoint;
|
||||
|
||||
private String scope;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.dataease.api.xpack.settings.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class XpackOauthTokenVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3594367641594329352L;
|
||||
|
||||
private String token;
|
||||
|
||||
private String idToken;
|
||||
}
|
||||
Reference in New Issue
Block a user