use of org.wso2.identity.integration.common.clients.challenge.questions.mgt.ChallengeQuestionMgtAdminClient in project product-is by wso2.
the class ChallengeQuestionManagementAdminServiceTestCase method checkSaaSAccess.
@Test(groups = "wso2.is", description = "Testing cross tenant access.")
public void checkSaaSAccess() throws Exception {
challengeQuestionsAdminClient = new ChallengeQuestionMgtAdminClient(backendURL, BOB_USERNAME, BOB_PASSWORD);
try {
challengeQuestionsAdminClient.getChallengeQuestionsForTenant(WSO2_TENANT);
fail(SUPER_TENANT + " user was able to access challenge questions in " + WSO2_TENANT);
} catch (Exception ex) {
assertTrue(ex.getMessage().contains("Unauthorized Access"));
}
}
use of org.wso2.identity.integration.common.clients.challenge.questions.mgt.ChallengeQuestionMgtAdminClient in project product-is by wso2.
the class ChallengeQuestionManagementAdminServiceTestCase method getDefaultChallengeQuestionsForUser.
@Test(groups = "wso2.is", description = "Get default questions if the locale doesn't have any questions set.", priority = 7, sequential = true)
public void getDefaultChallengeQuestionsForUser() throws Exception {
challengeQuestionsAdminClient = new ChallengeQuestionMgtAdminClient(backendURL, BOB_USERNAME, BOB_PASSWORD);
User bob = new User();
bob.setUserName(BOB_USERNAME);
bob.setTenantDomain(SUPER_TENANT);
// we need to confirm there are no challenge questions in Bob's locale
ChallengeQuestion[] localeQuestions = challengeQuestionsAdminClient.getChallengeQuestionsForLocale(SUPER_TENANT, BOB_LOCALE);
int bobLocale = localeQuestions == null ? 0 : localeQuestions.length;
assertTrue(bobLocale == 0, "Cannot have challenge questions in " + BOB_LOCALE);
// this should return us with default questions since Bob's locale doesn't have any challenge questions.
int count = challengeQuestionsAdminClient.getChallengeQuestionsForUser(bob).length;
assertTrue(count > 1, "Default Challenge Questions not retrieved for user : " + bob.toString());
}
use of org.wso2.identity.integration.common.clients.challenge.questions.mgt.ChallengeQuestionMgtAdminClient in project product-is by wso2.
the class ChallengeQuestionManagementAdminServiceTestCase method getChallengeQuestionByUser.
@Test(groups = "wso2.is", description = "Getting challenge questions of a user", priority = 5, sequential = true)
public void getChallengeQuestionByUser() throws Exception {
challengeQuestionsAdminClient = new ChallengeQuestionMgtAdminClient(backendURL, BOB_USERNAME, BOB_PASSWORD);
User bob = new User();
bob.setUserName(BOB_USERNAME);
bob.setTenantDomain(SUPER_TENANT);
int count = challengeQuestionsAdminClient.getChallengeQuestionsForUser(bob).length;
assertTrue(count == 1, "Challenge Questions not retrieved successfully for user : " + bob.toString());
}
use of org.wso2.identity.integration.common.clients.challenge.questions.mgt.ChallengeQuestionMgtAdminClient in project product-is by wso2.
the class ChallengeQuestionManagementAdminServiceTestCase method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
super.init();
loginManger = new AuthenticatorClient(backendURL);
// login as super tenant admin
loginManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
userMgtClient = new UserManagementClient(backendURL, sessionCookie);
remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient(backendURL, sessionCookie);
challengeQuestionsAdminClient = new ChallengeQuestionMgtAdminClient(backendURL, sessionCookie);
challengeQuestionsBobClient = new ChallengeQuestionMgtAdminClient(backendURL, BOB_USERNAME, BOB_PASSWORD);
createUsersAndRoles();
setSystemproperties();
}
use of org.wso2.identity.integration.common.clients.challenge.questions.mgt.ChallengeQuestionMgtAdminClient in project product-is by wso2.
the class ChallengeQuestionManagementAdminServiceTestCase method deleteChallengeQuestionsByLocale.
@Test(groups = "wso2.is", description = "Deleting challenge question in a locale", priority = 6, sequential = true)
public void deleteChallengeQuestionsByLocale() throws Exception {
challengeQuestionsAdminClient = new ChallengeQuestionMgtAdminClient(backendURL, isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getUserName());
// get challenge challenge questions of xx_YY locale
ChallengeQuestion[] challengeQuestions = challengeQuestionsAdminClient.getChallengeQuestionsForLocale(SUPER_TENANT, BOB_LOCALE);
// we should have challenge questions in the locale by now.
assertTrue(challengeQuestions != null && challengeQuestions.length > 0);
// delete all the challenge questions in the xx_YY locale
challengeQuestionsAdminClient.deleteChallengeQuestions(challengeQuestions, SUPER_TENANT);
// delete all added challenge questions in the en_US locale
challengeQuestionsAdminClient.deleteChallengeQuestions(new ChallengeQuestion[] { challengeQuestionSet1 }, SUPER_TENANT);
// retrieve challenge questions once again.
challengeQuestions = challengeQuestionsAdminClient.getChallengeQuestionsForLocale(SUPER_TENANT, BOB_LOCALE);
int numberOfQuestions = challengeQuestions == null ? 0 : challengeQuestions.length;
// now we shouldn't have challenge questions.
assertTrue(numberOfQuestions == 0);
}
Aggregations