Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.descope</groupId>
<artifactId>java-sdk</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>1.0.43</version>
<version>1.0.44</version>
<name>${project.groupId}:${project.artifactId}</name>
<description>Java library used to integrate with Descope.</description>
<url>https://github.com/descope/descope-java</url>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/descope/sdk/mgmt/InboundAppsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public interface InboundAppsService {

InboundApp loadApplication(String id) throws DescopeException;

InboundApp loadApplicationByClientId(String id) throws DescopeException;

String getApplicationSecret(String id) throws DescopeException;

String rotateApplicationSecret(String id) throws DescopeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ public InboundApp loadApplication(String id) throws DescopeException {
return apiProxy.get(getQueryParamUri(MANAGEMENT_INBOUND_LOAD_APP, mapOf("id", id)), InboundApp.class);
}

@Override
public InboundApp loadApplicationByClientId(String id) throws DescopeException {
if (StringUtils.isBlank(id)) {
throw ServerCommonException.invalidArgument("id");
}

ApiProxy apiProxy = getApiProxy();
return apiProxy.get(getQueryParamUri(MANAGEMENT_INBOUND_LOAD_APP, mapOf("clientId", id)), InboundApp.class);
}

@Override
public String getApplicationSecret(String id) throws DescopeException {
if (StringUtils.isBlank(id)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ void testMethodsForMissingRequestParts() {
thrown = assertThrows(ServerCommonException.class, () -> inboundAppsService.loadApplication(""));
assertNotNull(thrown);
assertEquals("The id argument is invalid", thrown.getMessage());
thrown = assertThrows(ServerCommonException.class, () -> inboundAppsService.loadApplicationByClientId(""));
assertNotNull(thrown);
assertEquals("The id argument is invalid", thrown.getMessage());
thrown = assertThrows(ServerCommonException.class, () -> inboundAppsService.getApplicationSecret(""));
assertNotNull(thrown);
assertEquals("The id argument is invalid", thrown.getMessage());
Expand Down Expand Up @@ -154,6 +157,18 @@ void testLoadApplicationSuccess() {
}
}

@Test
void testLoadApplicationByClientSuccess() {
ApiProxy apiProxy = mock(ApiProxy.class);
doReturn(mockInboundApp).when(apiProxy).get(any(), any());
try (MockedStatic<ApiProxyBuilder> mockedApiProxyBuilder = mockStatic(ApiProxyBuilder.class)) {
mockedApiProxyBuilder.when(() -> ApiProxyBuilder.buildProxy(any(), any())).thenReturn(apiProxy);
InboundApp app = inboundAppsService.loadApplicationByClientId("a");
assertNotNull(app);
assertEquals("someId", app.getId());
}
}

@Test
void testGetApplicationSecretSuccess() {
ApiProxy apiProxy = mock(ApiProxy.class);
Expand Down