<commit_before><!--
~ Copyright (c) 2005-2013, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~    http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied.  See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<%@page import="org.apache.axis2.context.ConfigurationContext"%>
<%@ page import="org.wso2.carbon.CarbonConstants"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig"%>
<%@ page
	import="org.wso2.carbon.identity.application.mgt.ui.ApplicationBean"%>
<%@ page import="org.wso2.carbon.identity.application.mgt.ui.client.ApplicationManagementServiceClient"%>
<%@page import="org.wso2.carbon.ui.CarbonUIMessage"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="carbon" uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"%>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@page import="java.util.HashMap"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="org.owasp.encoder.Encode" %>
<link href="css/idpmgt.css" rel="stylesheet" type="text/css" media="all"/>
<jsp:useBean id="appBean" class="org.wso2.carbon.identity.application.mgt.ui.ApplicationBean" scope="session"/>
<carbon:breadcrumb label="breadcrumb.service.provider" resourceBundle="org.wso2.carbon.identity.application.mgt.ui.i18n.Resources"
                    topPage="true" request="<%=request%>" />
<jsp:include page="../dialog/display_messages.jsp"/>


<script type="text/javascript" src="../admin/js/main.js"></script>



<%
if (appBean.getServiceProvider()==null || appBean.getServiceProvider().getApplicationName()==null){
// if appbean is not set properly redirect the user to list-service-provider.jsp.
%>
<script>
location.href = 'list-service-provider.jsp';
</script>
<% 
}
	String spName = appBean.getServiceProvider().getApplicationName();
	
	List<String> permissions = null;		
	permissions = appBean.getPermissions();
	
	String[] allClaimUris = appBean.getClaimUris();	
	Map<String, String> claimMapping = appBean.getClaimMapping();
	Map<String, String> roleMapping = appBean.getRoleMapping();
	boolean isLocalClaimsSelected = appBean.isLocalClaimsSelected();
    String idPName = request.getParameter("idPName");
    String action = request.getParameter("action");
    String[] userStoreDomains = null;
    boolean isNeedToUpdate = false;
    
    String authTypeReq =  request.getParameter("authType");
    if (authTypeReq!=null && authTypeReq.trim().length()>0){
    	appBean.setAuthenticationType(authTypeReq);
    }

    String samlIssuerName = request.getParameter("samlIssuer");


    if (samlIssuerName != null && "update".equals(action)){
    	appBean.setSAMLIssuer(samlIssuerName);
    	isNeedToUpdate = true;
    }
    
    if (samlIssuerName != null && "delete".equals(action)){
    	appBean.deleteSAMLIssuer();
        isNeedToUpdate = true;
    }

	samlIssuerName = appBean.getSAMLIssuer();


	String kerberosServicePrinciple = request.getParameter("kerberos");


	if (kerberosServicePrinciple != null && "update".equals(action)){
		appBean.setKerberosServiceName(kerberosServicePrinciple);
		isNeedToUpdate = true;
	}

	if (kerberosServicePrinciple != null && "delete".equals(action)){
		appBean.deleteKerberosApp();
		isNeedToUpdate = true;
	}


    String attributeConsumingServiceIndex = request.getParameter("attrConServIndex");
	if(attributeConsumingServiceIndex != null){
		appBean.setAttributeConsumingServiceIndex(attributeConsumingServiceIndex);
	}
    
    String oauthapp = request.getParameter("oauthapp");
    
    if (oauthapp!=null && "update".equals(action)){
    	appBean.setOIDCAppName(oauthapp);
    	isNeedToUpdate = true;
    }
    
    if (oauthapp!=null && "delete".equals(action)){
    	appBean.deleteOauthApp();
    }
    
    String oauthConsumerSecret = null;
    
    if(session.getAttribute("oauth-consum-secret")!= null && "update".equals(action)){
    	oauthConsumerSecret = (String) session.getAttribute("oauth-consum-secret");
    	appBean.setOauthConsumerSecret(oauthConsumerSecret);
    	session.removeAttribute("oauth-consum-secret");
    }
    
    oauthapp = appBean.getOIDCClientId();
   
    String wsTrust = request.getParameter("serviceName");
    
    if (wsTrust != null && "update".equals(action)){
    	appBean.setWstrustEp(wsTrust);
    	isNeedToUpdate = true;
    }
    
    if (wsTrust != null && "delete".equals(action)){
    	appBean.deleteWstrustEp();
    }
    
    wsTrust  = appBean.getWstrustSP();
    
    String display = request.getParameter("display");
    
    
    if(idPName != null && idPName.equals("")){
        idPName = null;
    }
    
    String authType = appBean.getAuthenticationType();

	StringBuffer localAuthTypes = new StringBuffer();
	String startOption = "<option value=\"";
	String middleOption = "\">";
	String endOPtion = "</option>";	
	String disbleText = " (Disabled)";
    
	StringBuffer requestPathAuthTypes = new StringBuffer();
	RequestPathAuthenticatorConfig[] requestPathAuthenticators = appBean.getRequestPathAuthenticators();

	if (requestPathAuthenticators!=null && requestPathAuthenticators.length>0){
		for(RequestPathAuthenticatorConfig reqAuth : requestPathAuthenticators) {
			requestPathAuthTypes.append(startOption + Encode.forHtmlAttribute((reqAuth.getName()) + middleOption + Encode.forHtmlContent(reqAuth.getDisplayName()) + endOPtion);
		}
	}
	
	Map<String, String> idpAuthenticators = new HashMap<String, String>();
	IdentityProvider[] federatedIdPs = appBean.getFederatedIdentityProviders();
	Map<String, String> proIdpConnector = new HashMap<String, String>();
	Map<String, String> enabledProIdpConnector = new HashMap<String, String>();
	Map<String, String> selectedProIdpConnectors = new HashMap<String, String>();
	Map<String, Boolean> idpStatus = new HashMap<String, Boolean>();
	Map<String, Boolean> IdpProConnectorsStatus = new HashMap<String, Boolean>();
<commit_msg>fix parenthesis issue<commit_after><!--
~ Copyright (c) 2005-2013, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~    http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied.  See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<%@page import="org.apache.axis2.context.ConfigurationContext"%>
<%@ page import="org.wso2.carbon.CarbonConstants"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig"%>
<%@ page import="org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig"%>
<%@ page
	import="org.wso2.carbon.identity.application.mgt.ui.ApplicationBean"%>
<%@ page import="org.wso2.carbon.identity.application.mgt.ui.client.ApplicationManagementServiceClient"%>
<%@page import="org.wso2.carbon.ui.CarbonUIMessage"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="carbon" uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"%>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@page import="java.util.HashMap"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="org.owasp.encoder.Encode" %>
<link href="css/idpmgt.css" rel="stylesheet" type="text/css" media="all"/>
<jsp:useBean id="appBean" class="org.wso2.carbon.identity.application.mgt.ui.ApplicationBean" scope="session"/>
<carbon:breadcrumb label="breadcrumb.service.provider" resourceBundle="org.wso2.carbon.identity.application.mgt.ui.i18n.Resources"
                    topPage="true" request="<%=request%>" />
<jsp:include page="../dialog/display_messages.jsp"/>


<script type="text/javascript" src="../admin/js/main.js"></script>



<%
if (appBean.getServiceProvider()==null || appBean.getServiceProvider().getApplicationName()==null){
// if appbean is not set properly redirect the user to list-service-provider.jsp.
%>
<script>
location.href = 'list-service-provider.jsp';
</script>
<% 
}
	String spName = appBean.getServiceProvider().getApplicationName();
	
	List<String> permissions = null;		
	permissions = appBean.getPermissions();
	
	String[] allClaimUris = appBean.getClaimUris();	
	Map<String, String> claimMapping = appBean.getClaimMapping();
	Map<String, String> roleMapping = appBean.getRoleMapping();
	boolean isLocalClaimsSelected = appBean.isLocalClaimsSelected();
    String idPName = request.getParameter("idPName");
    String action = request.getParameter("action");
    String[] userStoreDomains = null;
    boolean isNeedToUpdate = false;
    
    String authTypeReq =  request.getParameter("authType");
    if (authTypeReq!=null && authTypeReq.trim().length()>0){
    	appBean.setAuthenticationType(authTypeReq);
    }

    String samlIssuerName = request.getParameter("samlIssuer");


    if (samlIssuerName != null && "update".equals(action)){
    	appBean.setSAMLIssuer(samlIssuerName);
    	isNeedToUpdate = true;
    }
    
    if (samlIssuerName != null && "delete".equals(action)){
    	appBean.deleteSAMLIssuer();
        isNeedToUpdate = true;
    }

	samlIssuerName = appBean.getSAMLIssuer();


	String kerberosServicePrinciple = request.getParameter("kerberos");


	if (kerberosServicePrinciple != null && "update".equals(action)){
		appBean.setKerberosServiceName(kerberosServicePrinciple);
		isNeedToUpdate = true;
	}

	if (kerberosServicePrinciple != null && "delete".equals(action)){
		appBean.deleteKerberosApp();
		isNeedToUpdate = true;
	}


    String attributeConsumingServiceIndex = request.getParameter("attrConServIndex");
	if(attributeConsumingServiceIndex != null){
		appBean.setAttributeConsumingServiceIndex(attributeConsumingServiceIndex);
	}
    
    String oauthapp = request.getParameter("oauthapp");
    
    if (oauthapp!=null && "update".equals(action)){
    	appBean.setOIDCAppName(oauthapp);
    	isNeedToUpdate = true;
    }
    
    if (oauthapp!=null && "delete".equals(action)){
    	appBean.deleteOauthApp();
    }
    
    String oauthConsumerSecret = null;
    
    if(session.getAttribute("oauth-consum-secret")!= null && "update".equals(action)){
    	oauthConsumerSecret = (String) session.getAttribute("oauth-consum-secret");
    	appBean.setOauthConsumerSecret(oauthConsumerSecret);
    	session.removeAttribute("oauth-consum-secret");
    }
    
    oauthapp = appBean.getOIDCClientId();
   
    String wsTrust = request.getParameter("serviceName");
    
    if (wsTrust != null && "update".equals(action)){
    	appBean.setWstrustEp(wsTrust);
    	isNeedToUpdate = true;
    }
    
    if (wsTrust != null && "delete".equals(action)){
    	appBean.deleteWstrustEp();
    }
    
    wsTrust  = appBean.getWstrustSP();
    
    String display = request.getParameter("display");
    
    
    if(idPName != null && idPName.equals("")){
        idPName = null;
    }
    
    String authType = appBean.getAuthenticationType();

	StringBuffer localAuthTypes = new StringBuffer();
	String startOption = "<option value=\"";
	String middleOption = "\">";
	String endOPtion = "</option>";	
	String disbleText = " (Disabled)";
    
	StringBuffer requestPathAuthTypes = new StringBuffer();
	RequestPathAuthenticatorConfig[] requestPathAuthenticators = appBean.getRequestPathAuthenticators();

	if (requestPathAuthenticators!=null && requestPathAuthenticators.length>0){
		for(RequestPathAuthenticatorConfig reqAuth : requestPathAuthenticators) {
			requestPathAuthTypes.append(startOption + Encode.forHtmlAttribute(reqAuth.getName()) + middleOption + Encode.forHtmlContent(reqAuth.getDisplayName()) + endOPtion);
		}
	}
	
	Map<String, String> idpAuthenticators = new HashMap<String, String>();
	IdentityProvider[] federatedIdPs = appBean.getFederatedIdentityProviders();
	Map<String, String> proIdpConnector = new HashMap<String, String>();
	Map<String, String> enabledProIdpConnector = new HashMap<String, String>();
	Map<String, String> selectedProIdpConnectors = new HashMap<String, String>();
	Map<String, Boolean> idpStatus = new HashMap<String, Boolean>();
	Map<String, Boolean> IdpProConnectorsStatus = new HashMap<String, Boolean>();

{'fraction_non_alphanumeric': 0.14171420105192978, 'fraction_numerical': 0.004889251055633751, 'mean_word_length': 4.9445178335535, 'pattern_counts': {'":': 0, '<': 95, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7494030', 'n_tokens_mistral': 4348, 'n_tokens_neox': 4163, 'n_words': 756}