Added client type in the client list web-service. Resolved #58.
Change-Id: I17d89aae677932490502610b444bb01b66534f40
diff --git a/full/Changes b/full/Changes
index fd9f56e..2df16a6 100644
--- a/full/Changes
+++ b/full/Changes
@@ -8,6 +8,8 @@
2021-03-25
- Updated OAuth2 token list with token type and user clientId
parameters (margaretha)
+2021-03-29
+ - Added client type in the client list web-service (margaretha)
# version 0.63
26/10/2020
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java
index 64d88cc..23916f2 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java
@@ -1,5 +1,7 @@
package de.ids_mannheim.korap.oauth2.dto;
+import de.ids_mannheim.korap.oauth2.constant.OAuth2ClientType;
+
/** Lists authorized OAuth2 clients of a user
*
* @author margaretha
@@ -9,6 +11,7 @@
private String clientId;
private String clientName;
+ private OAuth2ClientType clientType;
private String description;
private String url;
@@ -36,4 +39,10 @@
public void setUrl (String url) {
this.url = url;
}
+ public OAuth2ClientType getClientType () {
+ return clientType;
+ }
+ public void setClientType (OAuth2ClientType clientType) {
+ this.clientType = clientType;
+ }
}
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
index 6624cf9..5406387 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
@@ -395,6 +395,7 @@
dto.setClientName(uc.getName());
dto.setDescription(uc.getDescription());
dto.setUrl(uc.getUrl());
+ dto.setClientType(uc.getType());
dtoList.add(dto);
}
return dtoList;
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
index a8acf4e..817e835 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
@@ -716,6 +716,7 @@
assertEquals(1, node.size());
assertEquals(clientName, node.at("/0/clientName").asText());
+ assertEquals(OAuth2ClientType.PUBLIC.name(), node.at("/0/clientType").asText());
String clientId = node.at("/0/clientId").asText();
testDeregisterPublicClient(clientId, "dory");
}