Commit edaa568bc885cbd6fb7e181f3b17a52e9793de36

Authored by Dima Landiak
Committed by Andrew Shvayka
1 parent 3e8824c5

added logs for oauth2 get clients method

@@ -19,11 +19,15 @@ import lombok.extern.slf4j.Slf4j; @@ -19,11 +19,15 @@ import lombok.extern.slf4j.Slf4j;
19 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.http.HttpStatus; 20 import org.springframework.http.HttpStatus;
21 import org.springframework.security.access.prepost.PreAuthorize; 21 import org.springframework.security.access.prepost.PreAuthorize;
22 -import org.springframework.web.bind.annotation.*; 22 +import org.springframework.web.bind.annotation.RequestBody;
  23 +import org.springframework.web.bind.annotation.RequestMapping;
  24 +import org.springframework.web.bind.annotation.RequestMethod;
  25 +import org.springframework.web.bind.annotation.ResponseBody;
  26 +import org.springframework.web.bind.annotation.ResponseStatus;
  27 +import org.springframework.web.bind.annotation.RestController;
23 import org.thingsboard.server.common.data.exception.ThingsboardException; 28 import org.thingsboard.server.common.data.exception.ThingsboardException;
24 import org.thingsboard.server.common.data.oauth2.OAuth2ClientInfo; 29 import org.thingsboard.server.common.data.oauth2.OAuth2ClientInfo;
25 import org.thingsboard.server.common.data.oauth2.OAuth2ClientsParams; 30 import org.thingsboard.server.common.data.oauth2.OAuth2ClientsParams;
26 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
27 import org.thingsboard.server.dao.oauth2.OAuth2Configuration; 31 import org.thingsboard.server.dao.oauth2.OAuth2Configuration;
28 import org.thingsboard.server.queue.util.TbCoreComponent; 32 import org.thingsboard.server.queue.util.TbCoreComponent;
29 import org.thingsboard.server.service.security.permission.Operation; 33 import org.thingsboard.server.service.security.permission.Operation;
@@ -31,6 +35,7 @@ import org.thingsboard.server.service.security.permission.Resource; @@ -31,6 +35,7 @@ import org.thingsboard.server.service.security.permission.Resource;
31 import org.thingsboard.server.utils.MiscUtils; 35 import org.thingsboard.server.utils.MiscUtils;
32 36
33 import javax.servlet.http.HttpServletRequest; 37 import javax.servlet.http.HttpServletRequest;
  38 +import java.util.Enumeration;
34 import java.util.List; 39 import java.util.List;
35 40
36 @RestController 41 @RestController
@@ -46,6 +51,14 @@ public class OAuth2Controller extends BaseController { @@ -46,6 +51,14 @@ public class OAuth2Controller extends BaseController {
46 @ResponseBody 51 @ResponseBody
47 public List<OAuth2ClientInfo> getOAuth2Clients(HttpServletRequest request) throws ThingsboardException { 52 public List<OAuth2ClientInfo> getOAuth2Clients(HttpServletRequest request) throws ThingsboardException {
48 try { 53 try {
  54 + if (log.isDebugEnabled()) {
  55 + log.debug("Executing getOAuth2Clients: [{}][{}][{}]", request.getScheme(), request.getServerName(), request.getServerPort());
  56 + Enumeration<String> headerNames = request.getHeaderNames();
  57 + while (headerNames.hasMoreElements()) {
  58 + String header = headerNames.nextElement();
  59 + log.debug("Header: {} {}", header, request.getHeader(header));
  60 + }
  61 + }
49 return oAuth2Service.getOAuth2Clients(MiscUtils.getScheme(request), MiscUtils.getDomainNameAndPort(request)); 62 return oAuth2Service.getOAuth2Clients(MiscUtils.getScheme(request), MiscUtils.getDomainNameAndPort(request));
50 } catch (Exception e) { 63 } catch (Exception e) {
51 throw handleException(e); 64 throw handleException(e);