Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Phytophthoraregistrering-VIPSUTV-735
  • UpdateGrovfor
  • VIPSInSchweiz
  • addIsPrivateToPOI-VIPSUTV-767
  • bugfix/vipsutv-706-observation-without-poi
  • develop
  • feature/time-series
  • feature/time-series-in-vipsweb
  • feature/upgrade-openlayers
  • feature/vipsutv-1047-timeseries
  • feature/vipsutv-405-observation-time-series
  • feature/vipsutv-710-download-excel
  • feature/vipsutv-737-map-module
  • fix/ensure-supported-locale
  • forecast-gridweather-option-vipsutv-610
  • freemarkertest
  • jakartaee-10
  • master
  • renovate-updates
  • renovate/no.nibio.vips-vipscommon-3.x
  • renovate/org.apache.commons-commons-csv-1.x
  • renovate/org.apache.poi-poi-5.x
  • renovate/org.apache.poi-poi-ooxml-5.x
  • renovate/org.flywaydb-flyway-core-11.x
  • renovate/org.flywaydb-flyway-database-postgresql-11.x
  • renovate/org.hibernate-hibernate-core-6.x
  • renovate/org.hibernate.orm-hibernate-spatial-6.x
  • renovate/org.postgresql-postgresql-42.x
  • renovate/selenium-4.x
  • revert-5e539475
  • revert-63b94469
  • revert-df8d2a9d
  • wildfly-34
  • Tag-Phenology-V3
34 results

Target

Select target project
  • VIPS/VIPSLogic
1 result
Select Git revision
  • Phytophthoraregistrering-VIPSUTV-735
  • UpdateGrovfor
  • VIPSInSchweiz
  • addIsPrivateToPOI-VIPSUTV-767
  • bugfix/vipsutv-706-observation-without-poi
  • develop
  • feature/time-series
  • feature/time-series-in-vipsweb
  • feature/upgrade-openlayers
  • feature/vipsutv-1047-timeseries
  • feature/vipsutv-405-observation-time-series
  • feature/vipsutv-710-download-excel
  • feature/vipsutv-737-map-module
  • fix/ensure-supported-locale
  • forecast-gridweather-option-vipsutv-610
  • freemarkertest
  • jakartaee-10
  • master
  • renovate-updates
  • renovate/no.nibio.vips-vipscommon-3.x
  • renovate/org.apache.commons-commons-csv-1.x
  • renovate/org.apache.poi-poi-5.x
  • renovate/org.apache.poi-poi-ooxml-5.x
  • renovate/org.flywaydb-flyway-core-11.x
  • renovate/org.flywaydb-flyway-database-postgresql-11.x
  • renovate/org.hibernate-hibernate-core-6.x
  • renovate/org.hibernate.orm-hibernate-spatial-6.x
  • renovate/org.postgresql-postgresql-42.x
  • renovate/selenium-4.x
  • revert-5e539475
  • revert-63b94469
  • revert-df8d2a9d
  • wildfly-34
  • Tag-Phenology-V3
34 results
Show changes
Commits on Source (47)
......@@ -4,7 +4,7 @@
# the first stage of our build will use a maven 3.6 parent image
FROM maven:3.6-openjdk-11 AS MAVEN_BUILD
FROM maven:3.8-openjdk-11 AS MAVEN_BUILD
# We need VIPSCommon too, so the source code must be available in the parent folder
COPY ./VIPSCommon ./VIPSCommon
......
......@@ -5,7 +5,7 @@
<groupId>no.nibio.vips.</groupId>
<artifactId>VIPSLogic</artifactId>
<packaging>war</packaging>
<version>2023.1</version>
<version>2024.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
......@@ -62,12 +62,12 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>10.4.1</version>
<version>10.5.0</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
<version>10.1.0</version>
<version>10.4.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
......@@ -93,6 +93,11 @@
<version>4.7.9.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-api</artifactId>
<version>30.1</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
......@@ -109,7 +114,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
......@@ -187,24 +192,24 @@
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.18.2</version>
<version>1.19.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.wololo</groupId>
<artifactId>jts2geojson</artifactId>
<version>0.16.1</version>
<version>0.18.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.2</version>
<version>1.10.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>no.nibio.vips</groupId>
<artifactId>VIPSCommon</artifactId>
<version>2.0.1</version>
<version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax</groupId>
......@@ -230,21 +235,6 @@
<artifactId>cron4j</artifactId>
<version>2.2.5</version>
</dependency>
<!--dependency>
<groupId>org.openid4java</groupId>
<artifactId>openid4java</artifactId>
<version>0.9.8</version>
</dependency-->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.19.1</version>
</dependency>
<!--dependency>
<groupId>edu.vt.middleware</groupId>
<artifactId>vt-password</artifactId>
<version>3.1.2</version>
</dependency-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
......@@ -258,7 +248,7 @@
<dependency>
<groupId>javax.measure</groupId>
<artifactId>unit-api</artifactId>
<version>1.0</version>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.webcohesion.enunciate</groupId>
......@@ -273,7 +263,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
<version>2.0.11</version>
<scope>provided</scope>
</dependency>
</dependencies>
......@@ -282,7 +272,7 @@
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......@@ -321,7 +311,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.3</version>
<version>3.2.5</version>
<configuration>
<argLine>-Xmx6048m</argLine>
</configuration>
......
......@@ -7,7 +7,12 @@ from selenium.webdriver.support import expected_conditions as EC
# https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/python/README.md
# BROWSER = 'chrome'
BROWSER = "firefox"
# BROWSER = "firefox"
BROWSER = "edge"
HOST_URL = "http://vipslogic-local.no"
#HOST_URL = "https://logic.testvips.nibio.no"
#HOST_URL = "https://logic.vips.nibio.no"
@pytest.fixture
......@@ -20,10 +25,15 @@ def browser():
firefox_options = webdriver.FirefoxOptions()
firefox_options.headless = False
driver = webdriver.Firefox(options=firefox_options)
elif BROWSER == "edge":
edge_options = webdriver.EdgeOptions()
edge_options.headless = False
driver = webdriver.Edge(options=edge_options)
else:
raise Exception("Browser must be set to either chrome or firefox")
raise Exception("Browser must be set to chrome, firefox or edge")
driver.get("http://vipslogic/index.html")
#driver.get("http://vipslogic/index.html")
driver.get(f"{HOST_URL}/index.html")
assert driver.title == "Please log in"
driver.implicitly_wait(0.5)
......@@ -45,7 +55,7 @@ def test_admin_organisms(browser):
link = WebDriverWait(browser, 15).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Organisms"]'))
)
assert link.get_attribute("href") == "http://vipslogic/organism"
assert link.get_attribute("href") == f"{HOST_URL}/organism"
link.click()
assert browser.title == "Organisms"
link = WebDriverWait(browser, 15).until(
......@@ -60,7 +70,7 @@ def test_admin_scheduling(browser):
link = WebDriverWait(browser, 10).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Scheduling"]'))
)
assert link.get_attribute("href") == "http://vipslogic/scheduling"
assert link.get_attribute("href") == f"{HOST_URL}/scheduling"
link.click()
assert browser.title == "Scheduling overview"
......@@ -70,7 +80,7 @@ def test_admin_organization_group(browser):
link = WebDriverWait(browser, 10).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Organization groups"]'))
)
assert link.get_attribute("href") == "http://vipslogic/organizationgroup"
assert link.get_attribute("href") == f"{HOST_URL}/organizationgroup"
link.click()
assert browser.title == "Organization groups"
......@@ -80,7 +90,7 @@ def test_admin_apple_fruit_moth(browser):
link = WebDriverWait(browser, 10).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Apple fruit moth"]'))
)
assert link.get_attribute("href") == "http://vipslogic/applefruitmoth"
assert link.get_attribute("href") == f"{HOST_URL}/applefruitmoth"
link.click()
assert browser.title == "Rognebærmøllstasjoner"
......@@ -90,7 +100,7 @@ def test_admin_users(browser):
link = WebDriverWait(browser, 20).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Users"]'))
)
assert link.get_attribute("href") == "http://vipslogic/user"
assert link.get_attribute("href") == f"{HOST_URL}/user"
link.click()
WebDriverWait(browser, 20).until(
EC.visibility_of_element_located((By.XPATH, "//h1[text()='Users']"))
......@@ -103,7 +113,7 @@ def test_admin_forecasts(browser):
link = WebDriverWait(browser, 20).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Forecasts"]'))
)
assert link.get_attribute("href") == "http://vipslogic/forecastConfiguration"
assert link.get_attribute("href") == f"{HOST_URL}/forecastConfiguration"
link.click()
WebDriverWait(browser, 20).until(
EC.visibility_of_element_located((By.XPATH, "//h1[text()='Forecasts']"))
......
......@@ -19,13 +19,6 @@
package no.nibio.vips.logic.controller.servlet;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
......@@ -88,70 +81,9 @@ public class LoginController extends HttpServlet {
// We remove the session attribute, so it doesn't stick
request.getSession().removeAttribute(LoginController.RETURN_UUID_PARAMETER_NAME);
// This means that an OpenId authentication has returned the user to this URL
// See code below
if(request.getServletPath().contains("oauth2callback"))
{
// Is it an authorization response?
if(request.getParameter("code") != null)
{
String authorizationCode = request.getParameter("code");
// Verify state
String storedState = (String) request.getSession().getAttribute("state");
String receivedState = request.getParameter("state");
if(receivedState == null || storedState == null || ! storedState.equals(receivedState))
{
request.setAttribute("errorMessageKey", "invalidcredentials");
request.getRequestDispatcher("/login.ftl").forward(request, response);
return;
}
// Use code, make request to Google for getting token with user information
GoogleTokenResponse tokenResponse = new GoogleAuthorizationCodeTokenRequest(
new NetHttpTransport(),
new JacksonFactory(),
System.getProperty("no.nibio.vips.logic.GOOGLE_OPENID_CLIENT_ID"),
System.getProperty("no.nibio.vips.logic.GOOGLE_OPENID_CLIENT_SECRET"),
authorizationCode,
Globals.PROTOCOL + "://" + ServletUtil.getServerName(request) + "/oauth2callback"
).execute();
GoogleIdToken idToken = GoogleIdToken.parse(new JacksonFactory(), tokenResponse.getIdToken());
Payload payload = idToken.getPayload();
// Try to find the user
VipsLogicUser user = userBean.getUser(payload.getSubject(), UserAuthenticationType.TYPE_OPENID_GOOGLE);
if(user != null)
{
request.getSession().setAttribute("user", user);
UUID uUUID = this.handleRememberUser(request, response, user, returnUUID);
if(returnUUID)
{
nextPage += (nextPage.contains("?") ? "&": "?") + "returnUUID=" + uUUID.toString();
}
if(nextPage.indexOf(Globals.PROTOCOL) == 0)
{
System.out.println("nextPage=" + nextPage);
response.sendRedirect(nextPage);
}
else
{
response.sendRedirect(new StringBuilder(Globals.PROTOCOL + "://").append(ServletUtil.getServerName(request)).append(nextPage).toString());
}
}
else
{
// This might be
// * a new user
// * an existing user logging in with OpenId/Google for the first time.
// Sending user to form asking this question
request.setAttribute("userAuthenticationTypeId", UserAuthenticationType.TYPE_OPENID_GOOGLE);
request.getSession().setAttribute("openId", payload.getSubject());
request.getRequestDispatcher("/registerOpenIdForm.ftl").forward(request, response);
}
}
}
// A log out request
else if(request.getServletPath().contains("logout"))
if(request.getServletPath().contains("logout"))
{
request.getSession().removeAttribute("user");
Cookie rememberedUser = ServletUtil.getCookie(request, "rememberedUser");
......@@ -230,39 +162,6 @@ public class LoginController extends HttpServlet {
}
}
/* Login with Google OpenConnect/OAuth2
For documentation about how this is done, see:
https://developers.google.com/accounts/docs/OAuth2WebServer
and https://developers.google.com/accounts/docs/OpenIDConnect
ClientID, ClientSecret, callbacks etc. has been created by logging
in to https://console.developers.google.com as tor-einar.skog@nibio.no
*/
else if(userAuthenticationTypeId.equals(UserAuthenticationType.TYPE_OPENID_GOOGLE))
{
// configure the return_to URL where your application will receive
// the authentication responses from the OpenID Connect provider
String serverName = ServletUtil.getServerName(request);
String callbackUrl = Globals.PROTOCOL + "://" + serverName + "/oauth2callback" ;
// We store the information about the next page in a session
// as Google does not accept to forward it
request.getSession().setAttribute("nextPage", URLEncoder.encode(nextPage, "UTF-8"));
request.getSession().setAttribute(LoginController.RETURN_UUID_PARAMETER_NAME, returnUUID);
request.getSession().setAttribute("rememberUser", request.getParameter("rememberUser"));
// Token to check for security (avoid man-in-the-middle)
String state = new BigInteger(130, new SecureRandom()).toString(32);
request.getSession().setAttribute("state", state);
String url =
new GoogleAuthorizationCodeRequestUrl(
System.getProperty("no.nibio.vips.logic.GOOGLE_OPENID_CLIENT_ID"),
callbackUrl,
Arrays.asList(
"https://www.googleapis.com/auth/userinfo.email")
)
.setState(state).build();
// Redirect to Google for authentication
response.sendRedirect(url);
}
// Authentication method not recognized, redirect to standard form
else
{
......
......@@ -34,7 +34,7 @@ public class SessionControllerGetter {
// This obviously has to be changed when changing the application name in Maven
// TODO: Refactor out to System properties (e.g. in standalone.xml in JBoss/WildFly)
public static final String JNDI_PATH = "java:global/VIPSLogic-2023.1/";
public static final String JNDI_PATH = "java:global/VIPSLogic-2024.1/";
public static SchedulingBean getSchedulingBean()
{
......
......@@ -50,10 +50,7 @@ import javax.persistence.PersistenceContext;
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import no.nibio.vips.logic.controller.session.SessionControllerGetter;
import no.nibio.vips.logic.controller.session.UserBean;
......@@ -67,6 +64,10 @@ import no.nibio.vips.logic.messaging.UniversalMessageFormat;
import no.nibio.vips.logic.util.GISEntityUtil;
import no.nibio.vips.logic.util.Globals;
import no.nibio.vips.logic.util.SimpleMailSender;
import org.geotools.api.referencing.FactoryException;
import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
import org.geotools.api.referencing.operation.MathTransform;
import org.geotools.api.referencing.operation.TransformException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
......@@ -195,7 +195,6 @@ public class ModelFormService {
ModelConfiguration mConf = new SeptoriaHumidityModelPreprocessor().getModelConfiguration(fConf);
Integer VIPSCoreUserId = organization.getDefaultVipsCoreUserId();
System.out.println("defaultVIPScoreUserId = " + VIPSCoreUserId);
List<Result>results = forecastBean.runForecast(mConf, VIPSCoreUserId);
......
......@@ -49,14 +49,6 @@
<a href="/user?action=registerNewUserForm&userAuthenticationTypeId=1">${i18nBundle.registerNewUser}</a><br/>
<a href="/user?action=resetPasswordRequestForm">${i18nBundle.forgottenPassword}</a>
</form>
<form class="form-signin" action="/loginsubmit" method="POST">
<input type="hidden" name="userAuthenticationTypeId" value="3"/>
<input type="hidden" name="nextPage" value="${nextPage!"/"}"/>
<input type="hidden" name="returnUUID" value="<#if returnUUID?has_content>${returnUUID?c!""}</#if>"/>
<h2 class="form-signin-heading">${i18nBundle.or}</h2>
<input type="image" src="/images/btn_sign_in_with_google.png" alt="${i18nBundle.signInWith} Google"/><br/>
<input type="checkbox" name="rememberUser"<#if checkRemember?has_content && checkRemember> checked="checked"</#if>/> ${i18nBundle.rememberLogin}
</form>
</div>
</#macro>
<@page_html/>