diff --git a/.mvn/.git-keep b/.mvn/.git-keep new file mode 100644 index 0000000..e69de29 diff --git a/pom.xml b/pom.xml index 33557d5..9632b5c 100644 --- a/pom.xml +++ b/pom.xml @@ -31,40 +31,6 @@ - - - - manual-properties - - - pairgoth.properties - - - - - - org.codehaus.mojo - properties-maven-plugin - 1.2.0 - - - initialize - - read-project-properties - - - - pairgoth.properties - - - - - - - - - - UTF-8 11 @@ -76,6 +42,7 @@ 3.5.0 3.1.1 3.3.0 + 3.2.3 3.1.1 3.3.0 3.5.0 @@ -103,14 +70,15 @@ localhost 8080 / - http://localhost:8080 + ${pairgoth.webapp.protocol}://${pairgoth.webapp.host}:${pairgoth.webapp.port}/${pairgoth.webapp.context} http localhost 8085 /api - http://localhost:8085/api + ${pairgoth.api.protocol}://${pairgoth.api.host}:${pairgoth.api.port}${pairgoth.api.context} file tournamentfiles + none 587 @@ -160,6 +128,11 @@ maven-enforcer-plugin ${maven.enforcer.plugin.version} + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven.failsafe.plugin.version} + org.apache.maven.plugins maven-install-plugin @@ -201,46 +174,6 @@ ${maven.war.plugin.version} - - org.codehaus.mojo - build-helper-maven-plugin - 3.4.0 - - - regex-property - - regex-property - - - webapp.port - ${webapp.url} - ^.*:(\d+).*$ - $1 - true - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 3.1.0 - - - echo-property - - run - - - - ----------------- webapp.port=${webapp.port} - - - - - - com.mycila license-maven-plugin @@ -251,6 +184,11 @@ kotlin-maven-plugin ${kotlin.version} + + properties-maven-plugin + org.codehaus.mojo + 1.2.1 + diff --git a/view-webapp/pom.xml b/view-webapp/pom.xml index ecb2550..dfc2938 100644 --- a/view-webapp/pom.xml +++ b/view-webapp/pom.xml @@ -91,6 +91,7 @@ ${pairgoth.logger.level} ${pairgoth.logger.format} debug + ${pairgoth.auth} debug diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt new file mode 100644 index 0000000..d0de1b7 --- /dev/null +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt @@ -0,0 +1,50 @@ +package org.jeudego.pairgoth.web + +import javax.servlet.Filter +import javax.servlet.FilterChain +import javax.servlet.FilterConfig +import javax.servlet.RequestDispatcher +import javax.servlet.ServletRequest +import javax.servlet.ServletResponse +import javax.servlet.http.HttpServletRequest +import javax.servlet.http.HttpServletResponse +import javax.servlet.http.HttpSession + +class AuthFilter: Filter { + + private lateinit var filterConfig: FilterConfig + + protected val defaultRequestDispatcher: RequestDispatcher by lazy { + filterConfig.servletContext.getNamedDispatcher("default") + } + + override fun init(filterConfig: FilterConfig) { + this.filterConfig = filterConfig + } + + override fun doFilter(req: ServletRequest, resp: ServletResponse, chain: FilterChain) { + val request = req as HttpServletRequest + val response = resp as HttpServletResponse + val uri = request.requestURI + val session: HttpSession? = request.getSession(false) + val auth = WebappManager.getProperty("auth") ?: throw Error("authentication not configured") + + if (auth == "none" || whitelist.contains(uri) || uri.contains(Regex("\\.(?!html)")) || session?.getAttribute("logged") != null) { + chain.doFilter(req, resp) + } else { + // TODO - configure if unauth requests are redirected and/or forwarded + // TODO - protection against brute force attacks + if (uri == "/index") { + request.getRequestDispatcher("/index-ffg").forward(req, resp) + } else { + response.sendRedirect("/login") + } + } + } + companion object { + private val whitelist = setOf( + "/index-ffg", + "/login" + ) + } +} \ No newline at end of file diff --git a/view-webapp/src/main/sass/main.scss b/view-webapp/src/main/sass/main.scss index 8f91417..8e9b508 100644 --- a/view-webapp/src/main/sass/main.scss +++ b/view-webapp/src/main/sass/main.scss @@ -349,4 +349,12 @@ position: sticky; top: 0; } + + #landing { + text-align: justify; + } + + a.disabled { + color: darkgray; + } } diff --git a/view-webapp/src/main/webapp/WEB-INF/pairgoth.default.properties b/view-webapp/src/main/webapp/WEB-INF/pairgoth.default.properties index 63e2350..a8cd0e6 100644 --- a/view-webapp/src/main/webapp/WEB-INF/pairgoth.default.properties +++ b/view-webapp/src/main/webapp/WEB-INF/pairgoth.default.properties @@ -19,6 +19,8 @@ api.external.url = http://localhost:8085/api store = file store.file.path = tournamentfiles +auth = none + # smtp smtp.sender = smtp.host = diff --git a/view-webapp/src/main/webapp/WEB-INF/web.xml b/view-webapp/src/main/webapp/WEB-INF/web.xml index 479ee16..0806011 100644 --- a/view-webapp/src/main/webapp/WEB-INF/web.xml +++ b/view-webapp/src/main/webapp/WEB-INF/web.xml @@ -17,6 +17,11 @@ com.republicate.slf4j.impl.IPTagFilter true + + auth-filter + org.jeudego.pairgoth.web.AuthFilter + true + dispatching-filter org.jeudego.pairgoth.web.DispatchingFilter @@ -35,6 +40,12 @@ REQUEST FORWARD + + auth-filter + /* + REQUEST + FORWARD + dispatching-filter /* diff --git a/view-webapp/src/main/webapp/index-ffg.html b/view-webapp/src/main/webapp/index-ffg.html index e2a7bab..ea0207f 100644 --- a/view-webapp/src/main/webapp/index-ffg.html +++ b/view-webapp/src/main/webapp/index-ffg.html @@ -1,43 +1,39 @@ -
+

Welcome to , your Go Pairing Engine!

What is ?

At its core, is a versatile Go tournament pairing engine designed to make your tournament experience effortless. is the successor of opengotha, the well known pairing system software developed by Luc Vannier and uses the same algorithm internally, as well as import and export features towards its format.

-

version 1.0-BETA supports the Swiss pairing system, ideal for championships with no handicap games, as well as the MacMahon pairing system, more suited for classical tournaments and cups.

-

Future versions will support more pairing systems and more features. Your feedback is welcome!

+

version 0.1 supports the Swiss pairing system, ideal for championships with no handicap games, as well as the MacMahon pairing system, more suited for classical tournaments and cups. It is still in an alpha stage. Future versions will support more pairing systems and more features. Your feedback is most welcome!

How to use ?

We offer you the flexibility to use in a way that best suits your needs. Here are your options:

  1. Stay in the browser: If you prefer convenience, you can simply use the instance graciously hosted by the French Go Federation.

    - Launch + Launch
  2. Launch a standalone instance: This mode allows you to run on your local computer.

    That's the best option if you feel more comfortable when running locally or whenever you want to be able to do the pairing without internet. You can choose to use either the standard interface (which is meant to look a lot like opengotha) and the web interface (by launching the engine and connecting to it using a browser).

    - Download standalone + + +
  3. Launch a pairing server: This mode is the best suited for big Go events like congresses, it allows to register players, enter results and manage pairing from several workstations at once.

    - Download client/server +
    Download the standalone web interface which suits your need, then follow the configuration guide (not yet available)
  4. Compile from the sources: the project is fully open source, and under the very permissive apache licence, allowing you to tweak it in any possible way. Be sure to contribute back your enhancements!

    +

    Since the project is still in alpha, the sources are only available to FFG actors. If that's your case, you can access the sources here:

    - Browse sources + + Browse sources on FFG's gitlab
- diff --git a/view-webapp/src/main/webapp/login.html b/view-webapp/src/main/webapp/login.html new file mode 100644 index 0000000..753ce72 --- /dev/null +++ b/view-webapp/src/main/webapp/login.html @@ -0,0 +1,23 @@ +
+
+
+ + + +
+
+
+ \ No newline at end of file diff --git a/webserver/pom.xml b/webserver/pom.xml index 97f8bec..1982a7d 100644 --- a/webserver/pom.xml +++ b/webserver/pom.xml @@ -10,7 +10,6 @@ jar Pairgoth Launcher - UTF-8 @@ -61,11 +60,6 @@ http2-server ${jetty.version} - - org.eclipse.jetty - jetty-slf4j-impl - ${jetty.version} - commons-io commons-io