-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…6095) * feat(jans-auth-server): included org_id in the response of DCR #5787 Signed-off-by: YuriyZ <yzabrovarniy@gmail.com> * minor Signed-off-by: YuriyZ <yzabrovarniy@gmail.com> * updated swagger with org_id Signed-off-by: YuriyZ <yzabrovarniy@gmail.com> --------- Signed-off-by: YuriyZ <yzabrovarniy@gmail.com> Signed-off-by: Mustafa Baser <mbaser@mail.com>
- Loading branch information
1 parent
a3ab169
commit c4df785
Showing
6 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...server/server/src/test/java/io/jans/as/server/register/ws/rs/RegisterJsonServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package io.jans.as.server.register.ws.rs; | ||
|
||
import io.jans.as.common.model.registration.Client; | ||
import io.jans.as.common.service.AttributeService; | ||
import io.jans.as.model.configuration.AppConfiguration; | ||
import io.jans.as.server.ciba.CIBARegisterClientResponseService; | ||
import io.jans.as.server.service.ClientService; | ||
import io.jans.as.server.service.ScopeService; | ||
import io.jans.util.security.StringEncrypter; | ||
import org.json.JSONObject; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.Spy; | ||
import org.mockito.testng.MockitoTestNGListener; | ||
import org.testng.annotations.Listeners; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.Date; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertNull; | ||
|
||
/** | ||
* @author Yuriy Z | ||
*/ | ||
@Listeners(MockitoTestNGListener.class) | ||
public class RegisterJsonServiceTest { | ||
|
||
@InjectMocks | ||
@Spy | ||
private RegisterJsonService registerJsonService; | ||
|
||
@Mock | ||
private AppConfiguration appConfiguration; | ||
|
||
@Mock | ||
private ClientService clientService; | ||
|
||
@Mock | ||
private ScopeService scopeService; | ||
|
||
@Mock | ||
private AttributeService attributeService; | ||
|
||
@Mock | ||
private CIBARegisterClientResponseService cibaRegisterClientResponseService; | ||
|
||
@Test | ||
public void getJSONObject_whenOrgIdSet_shouldHaveOrgIdPresentInJson() throws StringEncrypter.EncryptionException { | ||
Client client = new Client(); | ||
client.setOrganization("testOrgId"); | ||
client.setClientIdIssuedAt(new Date()); | ||
|
||
final JSONObject json = registerJsonService.getJSONObject(client); | ||
assertEquals(json.get("org_id"), "testOrgId"); | ||
} | ||
|
||
@Test | ||
public void getJSONObject_whenOrgIdIsNotSet_shouldHaveNullOrgIdInJson() throws StringEncrypter.EncryptionException { | ||
Client client = new Client(); | ||
client.setOrganization(null); | ||
client.setClientIdIssuedAt(new Date()); | ||
|
||
final JSONObject json = registerJsonService.getJSONObject(client); | ||
assertNull(json.opt("org_id")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters