if (request.getPortletMode() == PortletMode.VIEW)
{
String selectedSite = request.getParameter("ssoSite");
if (selectedSite != null)
{
SSOSite site = sso.getSiteByName(selectedSite);
if (site != null)
{
setPortletMessage(request, "selectedUrl", site.getURL());
setPortletMessage(request, "selectedName", site.getName());
setPortletMessage(request, "change", selectedSite);
setPortletMessage(request, "realm", site.getRealm());
setPortletMessage(request, "idField", site.getFormUserField());
setPortletMessage(request, "pwdField", site.getFormPwdField());
}
}
String refresh = request.getParameter("sso.refresh");
String save = request.getParameter("sso.save");
String neue = request.getParameter("sso.new");
String delete = request.getParameter("ssoDelete");
if (refresh != null)
{
this.clearBrowserIterator(request);
}
else if (neue != null)
{
clearPortletMessages(request,response);
}
else if (delete != null && (!(isEmpty(delete))))
{
try
{
SSOSite site = null;
site = sso.getSiteByName(delete);
if (site != null)
{
sso.removeSite(site);
this.clearBrowserIterator(request);
clearPortletMessages(request,response);
}
}
catch (SSOException e)
{
publishStatusMessage(request, "SSOBrowser", "status", e, "Could not remove site");
}
}
else if (save != null)
{
String siteName = request.getParameter("site.name");
String siteUrl = request.getParameter("site.url");
String siteRealm = request.getParameter("site.realm");
String siteFormID = request.getParameter("site.form_field_ID");
String siteFormPWD = request.getParameter("site.form_field_PWD");
if (!(isEmpty(siteName) || isEmpty(siteUrl)))
{
try
{
SSOSite site = null;
String old = (String)PortletMessaging.receive(request, "site", "selectedName");
if (old != null)
{
site = sso.getSiteByName(old);
}
else
{
site = sso.getSiteByName(siteName);
}
boolean isNewSite = false;
if (site == null)
{
isNewSite = true;
site = sso.newSite(siteName, siteUrl);
}
site.setName(siteName);
site.setURL(siteUrl);
site.setRealm(siteRealm);
site.setFormUserField(siteFormID);
site.setFormPwdField(siteFormPWD);
site.setFormAuthentication(StringUtils.isNotEmpty(siteFormID) && StringUtils.isNotEmpty(siteFormPWD));
site.setChallengeResponseAuthentication(!site.isFormAuthentication());
if (isNewSite)
{
sso.addSite(site);
} else