web.identity-mgt.challenges-set-mgt.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.wso2.carbon.identity.mgt.ui Show documentation
Show all versions of org.wso2.carbon.identity.mgt.ui Show documentation
A custom wso2 products or solution
The newest version!
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@page import="org.wso2.carbon.CarbonConstants" %>
<%@page import="org.wso2.carbon.identity.mgt.stub.dto.ChallengeQuestionDTO" %>
<%@page import="org.wso2.carbon.identity.mgt.ui.IdentityManagementAdminClient" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="java.util.List" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%
session.removeAttribute(IdentityManagementAdminClient.CHALLENGE_QUESTION);
List challenges = null;
HashSet questionSetNames = new HashSet();
try {
String cookie = (String) session
.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(),
session);
ConfigurationContext configContext = (ConfigurationContext) config
.getServletContext()
.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
IdentityManagementAdminClient client =
new IdentityManagementAdminClient(cookie, backendServerURL, configContext);
ChallengeQuestionDTO[] questionDTOs = client.getChallengeQuestions();
if(questionDTOs != null && questionDTOs.length > 0){
for(ChallengeQuestionDTO questionDTO : questionDTOs){
if(questionDTO.getQuestionSetId() != null){
questionSetNames.add(questionDTO.getQuestionSetId());
}
}
challenges = new ArrayList(Arrays.asList(questionDTOs));
session.setAttribute(IdentityManagementAdminClient.CHALLENGE_QUESTION, challenges);
}
} catch (Exception e) {
CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR,
request);
%>
<%
return;
}
%>
Challenge Questions Management
Add new challenge questions set
Challenge Questions Sets
<% if (questionSetNames.size() > 0) {
for (String questionSetName : questionSetNames) {
%>
<%=Encode.forHtmlContent(questionSetName)%>
Delete
<%
}
} else {
%>
No challenges questions set registered
<%
}
%>