Project

General

Profile

« Previous | Next » 

Revision aea2f0ea

Added by Andreas Kohlbecker over 3 years ago

ref #9220 registratin page using query param 'identifier' to protect against CVE-2007-0450 vulnerability

View differences:

src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java
9 9
import java.net.URL;
10 10
import java.util.ArrayList;
11 11
import java.util.List;
12
import java.util.Map;
13
import java.util.Map.Entry;
12 14
import java.util.concurrent.TimeUnit;
13 15
import java.util.regex.Matcher;
14 16
import java.util.regex.Pattern;
......
117 119
        return isZenTheme.booleanValue();
118 120
    }
119 121

  
122

  
120 123
    /**
121 124
     * Creates a new PortaPage. Implementations of this class will provide the base path of the page by
122 125
     * implementing the method {@link #getDrupalPageBase()}. The constructor argument <code>pagePathSuffix</code>
......
125 128
     * <li>{@link #getDrupalPageBase()} returns <code>/cdm_dataportal/taxon</code></li>
126 129
     * <li><code>pagePathSuffix</code> gives <code>7fe8a8b6-b0ba-4869-90b3-177b76c1753f</code></li>
127 130
     * </ol>
128
     * Both are combined to form the URL pathelement <code>/cdm_dataportal/taxon/7fe8a8b6-b0ba-4869-90b3-177b76c1753f</code>
131
     * Both are combined to form the URL path element <code>/cdm_dataportal/taxon/7fe8a8b6-b0ba-4869-90b3-177b76c1753f</code>
129 132
     *
130 133
     */
131
    public PortalPage(WebDriver driver, DataPortalContext context, String pagePathSuffix) throws MalformedURLException {
134
    public PortalPage(WebDriver driver, DataPortalContext context, String pagePathSuffix, Map<String, String> queryParameters) throws MalformedURLException {
132 135

  
133 136
        this.driver = driver;
134 137

  
......
138 141

  
139 142
        this.initialDrupalPagePath = getDrupalPageBase() + (pagePathSuffix != null ? "/" + pagePathSuffix: "");
140 143

  
141
        this.pageUrl = new URL(context.getSiteUri().toString() + "?" + DRUPAL_PAGE_QUERY + initialDrupalPagePath);
144
        StringBuilder queryStringB = new StringBuilder();
145
        if(queryParameters != null && !queryParameters.isEmpty()) {
146
            for(Entry<String, String> entry : queryParameters.entrySet()) {
147
                queryStringB.append("&").append(entry.getKey()).append("=").append(entry.getValue());
148
            }
149
        }
150
        this.pageUrl = new URL(context.getSiteUri().toString() + "?" + DRUPAL_PAGE_QUERY + initialDrupalPagePath + queryStringB.toString());
142 151

  
143 152
        // tell browser to navigate to the page
144 153
        logger.info("loading " + pageUrl);
......
151 160
        PageFactory.initElements(driver, this);
152 161

  
153 162
        pageHealthChecks();
163
    }
154 164

  
165
    /**
166
     * Creates a new PortaPage. Implementations of this class will provide the base path of the page by
167
     * implementing the method {@link #getDrupalPageBase()}. The constructor argument <code>pagePathSuffix</code>
168
     * specifies the specific page to navigate to. For example:
169
     * <ol>
170
     * <li>{@link #getDrupalPageBase()} returns <code>/cdm_dataportal/taxon</code></li>
171
     * <li><code>pagePathSuffix</code> gives <code>7fe8a8b6-b0ba-4869-90b3-177b76c1753f</code></li>
172
     * </ol>
173
     * Both are combined to form the URL path element <code>/cdm_dataportal/taxon/7fe8a8b6-b0ba-4869-90b3-177b76c1753f</code>
174
     *
175
     */
176
    public PortalPage(WebDriver driver, DataPortalContext context, String pagePathSuffix) throws MalformedURLException {
177
        this(driver, context, pagePathSuffix, null);
155 178
    }
156 179

  
157 180
    /**

Also available in: Unified diff