优化代码
This commit is contained in:
parent
295cedcaed
commit
74ae51d555
@ -0,0 +1,36 @@
|
|||||||
|
package cn.zyjblogs.server.client.controller;
|
||||||
|
|
||||||
|
import cn.zyjblogs.starter.common.entity.response.HttpCode;
|
||||||
|
import cn.zyjblogs.starter.common.entity.response.ResponseObject;
|
||||||
|
import cn.zyjblogs.starter.common.entity.response.ResponseResult;
|
||||||
|
import cn.zyjblogs.starter.web.apiversion.ApiVersion;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||||
|
import org.springframework.security.oauth2.provider.ClientDetailsService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Api(tags = {"客户端管理"})
|
||||||
|
@RestController
|
||||||
|
@ApiVersion(1)
|
||||||
|
@RequestMapping("/{v}/client")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OauthClientController {
|
||||||
|
private final ClientDetailsService oauthClientDetailsService;
|
||||||
|
|
||||||
|
@GetMapping("/findScopeList")
|
||||||
|
@ApiVersion(1)
|
||||||
|
public ResponseObject<Set<String>> getList(String clientId) {
|
||||||
|
ClientDetails clientDetails = oauthClientDetailsService.loadClientByClientId(clientId);
|
||||||
|
if (clientDetails == null) {
|
||||||
|
return ResponseResult.error(HttpCode.BAD_REQUEST, "该客户端不存在");
|
||||||
|
}
|
||||||
|
return ResponseResult.success(clientDetails.getScope());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package cn.zyjblogs.server.client.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class OauthClientNameVo {
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user