web.generic-sts.sts.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.sts.mgt.ui Show documentation
Show all versions of org.wso2.carbon.identity.sts.mgt.ui Show documentation
A custom wso2 products or solution
<%--
~ Copyright (c) 2010, 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"%>
<%@ 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.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.base.MultitenantConstants" %>
<%@ page import="org.wso2.carbon.identity.sts.mgt.stub.service.util.xsd.TrustedServiceData" %>
<%@ page import="org.wso2.carbon.identity.core.util.IdentityTenantUtil" %>
<%@page import="org.wso2.carbon.identity.sts.mgt.ui.client.CarbonSTSClient" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.CarbonUtils" %>
<%@ page import="org.wso2.carbon.utils.NetworkUtils" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%
TrustedServiceData[] services = null;
String[] aliases = null;
CarbonSTSClient sts = null;
String address = null;
String keyAlias = null;
String cookie = null;
String serverUrl = null;
String spName = request.getParameter("spName");
String action = request.getParameter("spAction");
String spAudience = request.getParameter("spAudience");
ConfigurationContext configurationContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
try {
String tenantDomain;
if (IdentityTenantUtil.isTenantQualifiedUrlsEnabled()) {
tenantDomain = IdentityTenantUtil.getTenantDomainFromContext();
} else {
tenantDomain = (String) session.getAttribute(MultitenantConstants.TENANT_DOMAIN);
}
String tenantContext = "";
if (! MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)){
tenantContext = MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + tenantDomain + "/";
}
if(CarbonUtils.isRunningOnLocalTransportMode()){
String mgtTransport = CarbonUtils.getManagementTransport();
int mgtTransportPort = CarbonUtils.getTransportPort(configurationContext,mgtTransport);
String ip = NetworkUtils.getLocalHostname();
serverUrl = mgtTransport + "://" + ip + ":" + mgtTransportPort + "/services/"+ tenantContext + "wso2carbon-sts";
}else{
serverUrl = CarbonUIUtil.getServerURL(config.getServletContext(), session) + tenantContext + "wso2carbon-sts";
}
cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
sts = new CarbonSTSClient(config, session, cookie);
aliases = sts.getAliasFromPrimaryKeystore();
services = sts.getTrustedServices();
if (action != null && "spEdit".equals(action)) {
if (services != null && services.length > 0) {
for (TrustedServiceData service : services) {
if (service!=null && service.getServiceAddress().equals(spAudience)){
keyAlias = service.getCertAlias();
break;
}
}
}
}
} catch (Exception e) {
%>
<%
return;
}
%>
<%if(spName==null) {%>
<%} %>