From 7eb95927846ca4b35834af7f4f002aaa6ecc6721 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Mon, 20 May 2024 19:39:39 +0200 Subject: [PATCH] initial commit --- .gitignore | 43 +++ build.gradle | 33 ++ config/formatting.xml | 337 ++++++++++++++++++ de.srsoftware.oidc.api/build.gradle | 18 + de.srsoftware.oidc.light/build.gradle | 29 ++ .../main/java/de/srsoftware/LightOICD.java | 34 ++ docker/compose.yml | 14 + settings.gradle | 5 + 8 files changed, 513 insertions(+) create mode 100644 .gitignore create mode 100644 build.gradle create mode 100644 config/formatting.xml create mode 100644 de.srsoftware.oidc.api/build.gradle create mode 100644 de.srsoftware.oidc.light/build.gradle create mode 100644 de.srsoftware.oidc.light/src/main/java/de/srsoftware/LightOICD.java create mode 100644 docker/compose.yml create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf3e1b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store +/.idea/ diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..303989d --- /dev/null +++ b/build.gradle @@ -0,0 +1,33 @@ +plugins { + id 'java' + id "com.diffplug.spotless" version "6.25.0" + +} + +group = 'de.srsoftware' +version = '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} + +spotless { + java { + target '*/src/*/java/**/*.java' + removeUnusedImports() + importOrder() + eclipse('4.26').configFile('config/formatting.xml') + licenseHeader '/* © SRSoftware $YEAR */' // or licenseHeaderFile + } +} + +compileJava.dependsOn 'spotlessApply' \ No newline at end of file diff --git a/config/formatting.xml b/config/formatting.xml new file mode 100644 index 0000000..036621c --- /dev/null +++ b/config/formatting.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/de.srsoftware.oidc.api/build.gradle b/de.srsoftware.oidc.api/build.gradle new file mode 100644 index 0000000..a928463 --- /dev/null +++ b/de.srsoftware.oidc.api/build.gradle @@ -0,0 +1,18 @@ +plugins { + id 'java' +} + +group = 'de.srsoftware' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/de.srsoftware.oidc.light/build.gradle b/de.srsoftware.oidc.light/build.gradle new file mode 100644 index 0000000..5356f91 --- /dev/null +++ b/de.srsoftware.oidc.light/build.gradle @@ -0,0 +1,29 @@ +plugins { + id 'java' + id 'war' +} + +group = 'de.srsoftware' +version = '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + compileOnly 'javax.servlet:javax.servlet-api:4.0.1' + implementation 'ch.qos.logback:logback-core:1.5.6' + implementation 'org.slf4j:slf4j-api:2.0.13' + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} + +war { + archiveFileName = 'oidc.war' +} + + diff --git a/de.srsoftware.oidc.light/src/main/java/de/srsoftware/LightOICD.java b/de.srsoftware.oidc.light/src/main/java/de/srsoftware/LightOICD.java new file mode 100644 index 0000000..a930fba --- /dev/null +++ b/de.srsoftware.oidc.light/src/main/java/de/srsoftware/LightOICD.java @@ -0,0 +1,34 @@ +/* © SRSoftware 2024 */ +package de.srsoftware; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Arrays; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@WebServlet(urlPatterns = "/") +public class LightOICD extends HttpServlet { + + private static final Logger LOG = LoggerFactory.getLogger(LightOICD.class); + + @Override + public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { + var path = Arrays.stream(req.getRequestURI().split("/")).skip(1).toList(); + resp.setContentType("text/html"); + PrintWriter out = resp.getWriter(); + out.println("Hello World Servlet"); + out.println(""); + out.println("

Hello Guys!

"); + out.println(""); + out.println(""); + out.close(); + } +} diff --git a/docker/compose.yml b/docker/compose.yml new file mode 100644 index 0000000..1893b3e --- /dev/null +++ b/docker/compose.yml @@ -0,0 +1,14 @@ +name: lightoidc + +services: + server: + container_name: lightOIDC + environment: + CATALINA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000 + hostname: guacamole + image: tomcat:9.0-jdk21-openjdk + ports: + - 8080:8080 + - 8000:8000 + volumes: + - ../de.srsoftware.oidc.light/build/libs/oidc.war:/usr/local/tomcat/webapps/ROOT.war diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..00f4d0d --- /dev/null +++ b/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'LightOIDC' +include 'de.srsoftware.oidc.api' +include 'de.srsoftware.oidc.light' +include 'de.srsoftware.oidc.server' +