comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java @ 6602:244beb29418e

Fix for SAML authentication in FLYSHeader's Info button (#702).
author Christian Lins <christian.lins@intevation.de>
date Thu, 18 Jul 2013 13:25:29 +0200
parents 7106f9b75004
children e562a9a42495
comparison
equal deleted inserted replaced
6601:5ecc6d4d73f2 6602:244beb29418e
20 import org.dive4elements.river.client.client.FLYS; 20 import org.dive4elements.river.client.client.FLYS;
21 import org.dive4elements.river.client.shared.model.User; 21 import org.dive4elements.river.client.shared.model.User;
22 22
23 public class WikiLinks 23 public class WikiLinks
24 { 24 {
25 public static String imageLinkForm(FLYS instance, String url, String imageUrl) { 25 public static String imageLinkForm(FLYS instance, String url, String imageUrl, String formName) {
26 String saml = null; 26 String saml = null;
27 if (instance != null && instance.getCurrentUser() != null) { 27 if (instance != null && instance.getCurrentUser() != null) {
28 saml = instance.getCurrentUser().getSamlXMLBase64(); 28 saml = instance.getCurrentUser().getSamlXMLBase64();
29 } 29 }
30 String quotedUrl = SafeHtmlUtils.htmlEscape(url); 30 String quotedUrl = SafeHtmlUtils.htmlEscape(url);
31 String quotedImage = SafeHtmlUtils.htmlEscape(imageUrl); 31 String quotedImage = SafeHtmlUtils.htmlEscape(imageUrl);
32 32
33 if (saml != null) { 33 if (saml != null) {
34 return "<form method=\"POST\" target=\"_blank\" action=\"" 34 return "<form method=\"POST\" target=\"_blank\" action=\""
35 + quotedUrl + "\">" 35 + quotedUrl + "\" " + "name=\"" + formName + "\">"
36 + "<input type=\"hidden\" name=\"saml\" value=\"" 36 + "<input type=\"hidden\" name=\"saml\" value=\""
37 + SafeHtmlUtils.htmlEscape(saml) + "\">" 37 + SafeHtmlUtils.htmlEscape(saml) + "\">"
38 + "<input type=\"image\" src=\""+ quotedImage + "\">" 38 + "<input type=\"image\" src=\""+ quotedImage + "\">"
39 + "</form>"; 39 + "</form>";
40 } 40 }
84 if (currentUser != null) { 84 if (currentUser != null) {
85 String saml = currentUser.getSamlXMLBase64(); 85 String saml = currentUser.getSamlXMLBase64();
86 saml = SafeHtmlUtils.htmlEscape(saml); 86 saml = SafeHtmlUtils.htmlEscape(saml);
87 GWT.log("saml=" + saml); 87 GWT.log("saml=" + saml);
88 DynamicForm form = new DynamicForm(); 88 DynamicForm form = new DynamicForm();
89 form.setID("wikiDynamicForm");
89 form.setMethod(FormMethod.POST); 90 form.setMethod(FormMethod.POST);
90 form.setTarget("_blank"); 91 form.setTarget("_blank");
91 form.setAction(quotedUrl); 92 form.setAction(quotedUrl);
92 form.setCanSubmit(true); 93 form.setCanSubmit(true);
93 HiddenItem item = new HiddenItem("saml"); 94 HiddenItem item = new HiddenItem("saml");
94 item.setDefaultValue(saml); 95 item.setDefaultValue(saml);
96 item.setValue(saml);
95 form.setFields(item); 97 form.setFields(item);
96 form.setValue("saml", saml); 98 //form.setValue("saml", saml);
97 return form; 99 return form;
98 } 100 }
99 else { 101 else {
100 DynamicForm form = new DynamicForm(); 102 DynamicForm form = new DynamicForm();
101 form.setTarget("_blank"); 103 form.setTarget("_blank");

http://dive4elements.wald.intevation.org