first commit

This commit is contained in:
Malopieds 2024-10-10 08:07:17 +02:00
commit 9928140682
Signed by: malopieds
GPG Key ID: 2E9430D75356529B
73 changed files with 29121 additions and 0 deletions

4989
.bloop/backend-test.json Normal file

File diff suppressed because it is too large Load Diff

4905
.bloop/backend.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
{
"javaSemanticDBVersion": "0.9.10",
"semanticDBVersion": "4.9.3",
"supportedScalaVersions": [
"2.13.14",
"2.12.19",
"2.12.18",
"2.12.17",
"2.12.16",
"2.13.11",
"2.13.12",
"2.13.13",
"2.11.12",
"2.12.12",
"2.12.13",
"2.12.14",
"2.12.15",
"2.13.7",
"2.13.8",
"2.13.9",
"2.13.10"
]
}

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*

43
.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml
# Eclipse
.project
.classpath
.settings/
bin/
# IntelliJ
.idea
*.ipr
*.iml
*.iws
# NetBeans
nb-configuration.xml
# Visual Studio Code
.vscode
.factorypath
# OSX
.DS_Store
# Vim
*.swp
*.swo
# patch
*.orig
*.rej
# Local environment
.env
# Plugin directory
/.quarkus/cli/plugins/

View File

@ -0,0 +1,60 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/AdminResource.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/AdminResource.java
text:
```scala
package fr.la_banquise.backend;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import io.quarkus.security.Authenticated;
@Path("/api/admin")
@Authenticated
public class AdminResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String admin() {
return "granted";
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,71 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Test.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Test.java
text:
```scala
package fr.la_banquise.backend;
import org.eclipse.microprofile.jwt.JsonWebToken;
import io.quarkus.security.Authenticated;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* Test
*/
@Path("/admin")
public class Test {
@Inject
JsonWebToken jwt;
@GET
@RolesAllowed("user")
@Produces(MediaType.TEXT_PLAIN)
public String test(){
return "Access for subject " + jwt.getSubject() + " is granted";
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,82 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
text:
```scala
package fr.la_banquise.backend.data.model;
import java.util.List;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* TpModel
*/
@Entity
@Table(name = "tps")
public class TpModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpModel(String name, String description, String pdfLink, String givenLink, String respo, String endDate) {
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpModel() {
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,71 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Test.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Test.java
text:
```scala
package fr.la_banquise.backend;
import org.eclipse.microprofile.jwt.JsonWebToken;
import io.quarkus.security.Authenticated;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* Test
*/
@Path("/admin")
public class Test {
@Inject
JsonWebToken jwt;
@GET
@RolesAllowed("user")
@Produces(MediaType.TEXT_PLAIN)
public String test(){
return "Access for subject " + jwt.getSubject() + " is granted";
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,70 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Test.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Test.java
text:
```scala
package fr.la_banquise.backend;
import org.eclipse.microprofile.jwt.JsonWebToken;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* Test
*/
@Path("/admin")
public class Test {
@Inject
JsonWebToken jwt;
@GET
@RolesAllowed("user")
@Produces(MediaType.TEXT_PLAIN)
public String test(){
return "Access for subject " + jwt.getSubject() + " is granted";
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,82 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
text:
```scala
package fr.la_banquise.backend.data.model;
import java.util.List;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* TpModel
*/
@Entity
@Table(name = "tps")
public class TpModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpModel(String name, String description, String pdfLink, String givenLink, String respo, String endDate) {
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpModel() {
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,81 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
text:
```scala
package fr.la_banquise.backend.data.model;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* TpModel
*/
@Entity
@Table(name = "tps")
public class TpModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpModel(String name, String description, String pdfLink, String givenLink, String respo, String endDate) {
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpModel() {
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,73 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/domain/entity/TpItemEntity.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/domain/entity/TpItemEntity.java
text:
```scala
package fr.la_banquise.backend.domain.entity;
import java.util.List;
/**
* TpItemEntity
*/
public class TpItemEntity {
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpItemEntity(Long id, String name, String description,String pdfLink, String givenLink, String respo, String endDate) {
this.id = id;
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpItemEntity() {
//TODO Auto-generated constructor stub
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,73 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/domain/entity/TpItemEntity.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/domain/entity/TpItemEntity.java
text:
```scala
package fr.la_banquise.backend.domain.entity;
import java.util.List;
/**
* TpItemEntity
*/
public class TpItemEntity {
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpItemEntity(Long id, String name, String description,String pdfLink, String givenLink, String respo, String endDate) {
this.id = id;
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpItemEntity() {
//TODO Auto-generated constructor stub
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,62 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Auth.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/Auth.java
text:
```scala
package fr.la_banquise.backend;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
/**
* Auth
*/
@Path("/user")
public class Auth {
@GET
@RolesAllowed("user")
public Response hello() {
return Response.ok("Hello from Quarkus!").build();
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

View File

@ -0,0 +1,81 @@
file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
### java.util.NoSuchElementException: next on empty iterator
occurred in the presentation compiler.
presentation compiler configuration:
Scala version: 3.3.3
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar [exists ]
Options:
action parameters:
uri: file://<WORKSPACE>/src/main/java/fr/la_banquise/backend/data/model/TpModel.java
text:
```scala
package fr.la_banquise.backend.data.model;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* TpModel
*/
@Entity
@Table(name = "tps")
public class TpModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpModel(String name, String description, String pdfLink, String givenLink, String respo, String endDate) {
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpModel() {
}
}
```
#### Error stacktrace:
```
scala.collection.Iterator$$anon$19.next(Iterator.scala:973)
scala.collection.Iterator$$anon$19.next(Iterator.scala:971)
scala.collection.mutable.MutationTracker$CheckedIterator.next(MutationTracker.scala:76)
scala.collection.IterableOps.head(Iterable.scala:222)
scala.collection.IterableOps.head$(Iterable.scala:222)
scala.collection.AbstractIterable.head(Iterable.scala:933)
dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:168)
scala.meta.internal.pc.MetalsDriver.run(MetalsDriver.scala:45)
scala.meta.internal.pc.PcCollector.<init>(PcCollector.scala:44)
scala.meta.internal.pc.PcSemanticTokensProvider$Collector$.<init>(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector$lzyINIT1(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.Collector(PcSemanticTokensProvider.scala:61)
scala.meta.internal.pc.PcSemanticTokensProvider.provide(PcSemanticTokensProvider.scala:90)
scala.meta.internal.pc.ScalaPresentationCompiler.semanticTokens$$anonfun$1(ScalaPresentationCompiler.scala:110)
```
#### Short summary:
java.util.NoSuchElementException: next on empty iterator

15778
.metals/metals.log Normal file

File diff suppressed because it is too large Load Diff

BIN
.metals/metals.mv.db Normal file

Binary file not shown.

1
.mvn/wrapper/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
maven-wrapper.jar

View File

@ -0,0 +1,98 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.IOException;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
public final class MavenWrapperDownloader
{
private static final String WRAPPER_VERSION = "3.2.0";
private static final boolean VERBOSE = Boolean.parseBoolean( System.getenv( "MVNW_VERBOSE" ) );
public static void main( String[] args )
{
log( "Apache Maven Wrapper Downloader " + WRAPPER_VERSION );
if ( args.length != 2 )
{
System.err.println( " - ERROR wrapperUrl or wrapperJarPath parameter missing" );
System.exit( 1 );
}
try
{
log( " - Downloader started" );
final URL wrapperUrl = new URL( args[0] );
final String jarPath = args[1].replace( "..", "" ); // Sanitize path
final Path wrapperJarPath = Paths.get( jarPath ).toAbsolutePath().normalize();
downloadFileFromURL( wrapperUrl, wrapperJarPath );
log( "Done" );
}
catch ( IOException e )
{
System.err.println( "- Error downloading: " + e.getMessage() );
if ( VERBOSE )
{
e.printStackTrace();
}
System.exit( 1 );
}
}
private static void downloadFileFromURL( URL wrapperUrl, Path wrapperJarPath )
throws IOException
{
log( " - Downloading to: " + wrapperJarPath );
if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null )
{
final String username = System.getenv( "MVNW_USERNAME" );
final char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray();
Authenticator.setDefault( new Authenticator()
{
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication( username, password );
}
} );
}
try ( InputStream inStream = wrapperUrl.openStream() )
{
Files.copy( inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING );
}
log( " - Downloader complete" );
}
private static void log( String msg )
{
if ( VERBOSE )
{
System.out.println( msg );
}
}
}

18
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

53
README.md Normal file
View File

@ -0,0 +1,53 @@
# backend
This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
## Running the application in dev mode
You can run your application in dev mode that enables live coding using:
```shell script
./mvnw compile quarkus:dev
```
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
## Packaging and running the application
The application can be packaged using:
```shell script
./mvnw package
```
It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
Be aware that its not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.
The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
If you want to build an _über-jar_, execute the following command:
```shell script
./mvnw package -Dquarkus.package.type=uber-jar
```
The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.
## Creating a native executable
You can create a native executable using:
```shell script
./mvnw package -Dnative
```
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
```shell script
./mvnw package -Dnative -Dquarkus.native.container-build=true
```
You can then execute your native executable with: `./target/backend-1.0.0-SNAPSHOT-runner`
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.
## Related Guides
- REST JSON-B ([guide](https://quarkus.io/guides/rest#json-serialisation)): JSON-B serialization support for Quarkus REST. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.
- OpenID Connect ([guide](https://quarkus.io/guides/security-openid-connect)): Verify Bearer access tokens and authenticate users with Authorization Code Flow

308
mvnw vendored Executable file
View File

@ -0,0 +1,308 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Apache Maven Wrapper startup batch script, version 3.2.0
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "$(uname)" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
else
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=$(java-config --jre-home)
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=$(which readlink)
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
if $darwin ; then
javaHome="$(dirname "\"$javaExecutable\"")"
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
else
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
fi
javaHome="$(dirname "\"$javaExecutable\"")"
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=$(cd "$wdir/.." || exit 1; pwd)
fi
# end of workaround
done
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
# Remove \r in case we run on Windows within Git Bash
# and check out the repository with auto CRLF management
# enabled. Otherwise, we may read lines that are delimited with
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
# splitting rules.
tr -s '\r\n' ' ' < "$1"
fi
}
log() {
if [ "$MVNW_VERBOSE" = true ]; then
printf '%s\n' "$1"
fi
}
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
log "$MAVEN_PROJECTBASEDIR"
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
if [ -r "$wrapperJarPath" ]; then
log "Found $wrapperJarPath"
else
log "Couldn't find $wrapperJarPath, downloading it ..."
if [ -n "$MVNW_REPOURL" ]; then
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
else
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
fi
while IFS="=" read -r key value; do
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
safeValue=$(echo "$value" | tr -d '\r')
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
esac
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
log "Downloading from: $wrapperUrl"
if $cygwin; then
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
fi
if command -v wget > /dev/null; then
log "Found wget ... using wget"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
log "Found curl ... using curl"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
else
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
fi
else
log "Falling back to using Java to download"
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaSource=$(cygpath --path --windows "$javaSource")
javaClass=$(cygpath --path --windows "$javaClass")
fi
if [ -e "$javaSource" ]; then
if [ ! -e "$javaClass" ]; then
log " - Compiling MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/javac" "$javaSource")
fi
if [ -e "$javaClass" ]; then
log " - Running MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
wrapperSha256Sum=""
while IFS="=" read -r key value; do
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
esac
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
if [ -n "$wrapperSha256Sum" ]; then
wrapperSha256Result=false
if command -v sha256sum > /dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
wrapperSha256Result=true
fi
elif command -v shasum > /dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
wrapperSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
exit 1
fi
if [ $wrapperSha256Result = false ]; then
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
exit 1
fi
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# shellcheck disable=SC2086 # safe args
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

205
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,205 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Apache Maven Wrapper startup batch script, version 3.2.0
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %WRAPPER_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
SET WRAPPER_SHA_256_SUM=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
)
IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
if ERRORLEVEL 1 goto error
)
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

149
pom.xml Normal file
View File

@ -0,0 +1,149 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.la_banquise</groupId>
<artifactId>backend</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.12.1</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.10.1</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire-plugin.version>3.2.5</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.qute.web</groupId>
<artifactId>quarkus-qute-web</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-qute</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-multipart</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security-ldap</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.quinoa</groupId>
<artifactId>quarkus-quinoa</artifactId>
<version>2.3.10</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,97 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
#
# ./mvnw package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/backend-jvm .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/backend-jvm
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
# when running the container
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 quarkus/backend-jvm
#
# This image uses the `run-java.sh` script to run the application.
# This scripts computes the command line to execute your Java application, and
# includes memory/GC tuning.
# You can configure the behavior using the following environment properties:
# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class")
# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
# in JAVA_OPTS (example: "-Dsome.property=foo")
# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
# used to calculate a default maximal heap memory based on a containers restriction.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
# of the container available memory as set here. The default is `50` which means 50%
# of the available memory is used as an upper boundary. You can skip this mechanism by
# setting this value to `0` in which case no `-Xmx` option is added.
# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
# is used to calculate a default initial heap memory based on the maximum heap memory.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
# is used as the initial heap size. You can skip this mechanism by setting this value
# to `0` in which case no `-Xms` option is added (example: "25")
# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
# This is used to calculate the maximum value of the initial heap memory. If used in
# a container without any memory constraints for the container then this option has
# no effect. If there is a memory constraint then `-Xms` is limited to the value set
# here. The default is 4096MB which means the calculated value of `-Xms` never will
# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
# when things are happening. This option, if set to true, will set
# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
# true").
# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
# - CONTAINER_CORE_LIMIT: A calculated core limit as described in
# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
# (example: "20")
# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
# (example: "40")
# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
# (example: "4")
# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
# previous GC times. (example: "90")
# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
# contain the necessary JRE command-line options to specify the required GC, which
# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.18
ENV LANGUAGE='en_US:en'
# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 target/quarkus-app/*.jar /deployments/
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
EXPOSE 8080
USER 185
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

View File

@ -0,0 +1,93 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
#
# ./mvnw package -Dquarkus.package.type=legacy-jar
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/backend-legacy-jar .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/backend-legacy-jar
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
# when running the container
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 quarkus/backend-legacy-jar
#
# This image uses the `run-java.sh` script to run the application.
# This scripts computes the command line to execute your Java application, and
# includes memory/GC tuning.
# You can configure the behavior using the following environment properties:
# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class")
# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
# in JAVA_OPTS (example: "-Dsome.property=foo")
# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
# used to calculate a default maximal heap memory based on a containers restriction.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
# of the container available memory as set here. The default is `50` which means 50%
# of the available memory is used as an upper boundary. You can skip this mechanism by
# setting this value to `0` in which case no `-Xmx` option is added.
# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
# is used to calculate a default initial heap memory based on the maximum heap memory.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
# is used as the initial heap size. You can skip this mechanism by setting this value
# to `0` in which case no `-Xms` option is added (example: "25")
# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
# This is used to calculate the maximum value of the initial heap memory. If used in
# a container without any memory constraints for the container then this option has
# no effect. If there is a memory constraint then `-Xms` is limited to the value set
# here. The default is 4096MB which means the calculated value of `-Xms` never will
# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
# when things are happening. This option, if set to true, will set
# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
# true").
# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
# - CONTAINER_CORE_LIMIT: A calculated core limit as described in
# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
# (example: "20")
# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
# (example: "40")
# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
# (example: "4")
# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
# previous GC times. (example: "90")
# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
# contain the necessary JRE command-line options to specify the required GC, which
# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.18
ENV LANGUAGE='en_US:en'
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/quarkus-run.jar
EXPOSE 8080
USER 185
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

View File

@ -0,0 +1,27 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
#
# Before building the container image run:
#
# ./mvnw package -Dnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native -t quarkus/backend .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/backend
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

View File

@ -0,0 +1,30 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
# It uses a micro base image, tuned for Quarkus native executables.
# It reduces the size of the resulting container image.
# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image.
#
# Before building the container image run:
#
# ./mvnw package -Dnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/backend .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/backend
#
###
FROM quay.io/quarkus/quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

View File

@ -0,0 +1,20 @@
package fr.la_banquise.backend;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import io.quarkus.security.Authenticated;
@Path("/api/admin")
@Authenticated
public class AdminResource {
@GET
@RolesAllowed("admin")
@Produces(MediaType.TEXT_PLAIN)
public String admin() {
return "granted";
}
}

View File

@ -0,0 +1,19 @@
package fr.la_banquise.backend;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
/**
* Auth
*/
@Path("/user")
public class Auth {
@GET
@RolesAllowed("user")
public Response hello() {
return Response.ok("Hello from Quarkus!").build();
}
}

View File

@ -0,0 +1,24 @@
package fr.la_banquise.backend;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import io.quarkus.qute.TemplateInstance;
import io.quarkus.qute.Template;
@Path("hello")
public class HelloResource {
@Inject
Template hello;
@GET
@Produces(MediaType.TEXT_PLAIN)
public TemplateInstance get(@QueryParam("name") String name) {
return hello.data("name", "malo");
}
}

View File

@ -0,0 +1,27 @@
package fr.la_banquise.backend;
import io.quarkus.security.Authenticated;
import io.quarkus.security.identity.SecurityIdentity;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
/**
* Login
*/
@Authenticated
@Path("/logged")
public class Login {
@Inject
SecurityIdentity identity;
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response login() {
System.out.println(identity.getPrincipal());
return Response.ok(identity.getPrincipal()).build();
}
}

View File

@ -0,0 +1,22 @@
package fr.la_banquise.backend;
import java.io.InputStream;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.core.MediaType;
import org.jboss.resteasy.annotations.providers.multipart.PartType;
/**
* MultipartBody
*/
public class MultipartBody {
@FormParam("file")
@PartType(MediaType.APPLICATION_OCTET_STREAM)
public InputStream file;
@FormParam("fileName")
@PartType(MediaType.TEXT_PLAIN)
public String fileName;
}

View File

@ -0,0 +1,21 @@
package fr.la_banquise.backend;
import io.quarkus.security.Authenticated;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
@Path("/mabite")
@Authenticated
public class SecureResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
@RolesAllowed("admin")
public String secure() {
return "This is a secured resource";
}
}

View File

@ -0,0 +1,21 @@
package fr.la_banquise.backend;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* Test
*/
@Path("/admin")
public class Test {
@GET
@RolesAllowed("user")
@Produces(MediaType.TEXT_PLAIN)
public String test() {
return "Access for subject " + " is granted";
}
}

View File

@ -0,0 +1,82 @@
package fr.la_banquise.backend;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.SecurityContext;
import io.quarkus.security.Authenticated;
@Path("/api/user")
@Authenticated
public class UsersResource {
@GET
@Path("/me")
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("user")
// public Response<Map<String, Object>> me(@Context SecurityContext
// securityContext) {
public Response me() {
// OidcJwtCallerPrincipal principal = (OidcJwtCallerPrincipal)
// securityContext.getUserPrincipal();
// Map<String, Object> claims = principal.getClaims().getClaimsMap();
// System.out.println(claims);
// Map<String, Object> userInfo = new HashMap<>();
// userInfo.put("username", claims.get("name"));
// userInfo.put("username", "malo");
// userInfo.put("email", token.getEmail());
// userInfo.put("firstName", token.getGivenName());
// userInfo.put("lastName", token.getFamilyName());
String test = "yess";
return Response.ok(test).build();
}
// @Inject
// SecurityIdentity identity;
//
// @GET
// @Path("/me")
// public User me() {
// return new User(identity);
// }
//
// public static class User {
// private final String userName;
// private final Set<String> roles;
// private final String sshKey;
//
// User(SecurityIdentity identity) {
// this.userName = identity.getPrincipal().getName();
// this.roles = identity.getRoles();
//
// if (identity.getPrincipal() instanceof OidcJwtCallerPrincipal) {
// OidcJwtCallerPrincipal oidcJwtCallerPrincipal = (OidcJwtCallerPrincipal)
// identity.getPrincipal();
// // Map<String, Object> claims =
// oidcJwtCallerPrincipal.getClaims().getClaimsMap();
// // System.out.println(claims.get("ssh-key"));
// this.sshKey = (String) oidcJwtCallerPrincipal.getClaim("ssh-key");
// } else {
// this.sshKey = null;
// }
// }
//
// public String getUserName() {
// return userName;
// }
//
// public Set<String> getRoles() {
// return roles;
// }
//
// public String getSshKey() {
// return sshKey;
// }
// }
}

View File

@ -0,0 +1,94 @@
package fr.la_banquise.backend.api;
import java.io.IOException;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.stream.Collectors;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import fr.la_banquise.backend.api.response.LdapUserParser;
import fr.la_banquise.backend.api.response.UserLdap;
import fr.la_banquise.backend.api.response.UserLdapResponse;
import fr.la_banquise.backend.api.response.LdapUserParser.User;
import fr.la_banquise.backend.data.model.UserModel;
import fr.la_banquise.backend.domain.service.UserService;
import fr.la_banquise.backend.utils.RequestsHttp;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.MediaType;
/**
* ApiUsers
*/
@Path("/api/users")
@Produces(MediaType.APPLICATION_JSON)
public class ApiUsers {
@Inject
UserService userService;
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response getUsers() {
return Response.ok(userService.getUsers()).build();
}
@POST
@RolesAllowed("admin")
@Path("sync")
public Response syncUsers() {
String jsonBody = "{\"variables\":{\"filters\":null},\"query\":\"query ListUsersQuery($filters: RequestFilter) { users(filters: $filters) { id email displayName firstName lastName creationDate }}query ListUserNames($filters: RequestFilter) { users(filters: $filters) { id displayName }}\",\"operationName\":\"ListUsersQuery\"}";
HttpResponse<String> response = RequestsHttp.callLdap("http://localhost:17170/api/graphql", jsonBody);
if (response == null) {
return Response.status(500).build();
}
ObjectMapper mapper = new ObjectMapper();
LdapUserParser users;
try {
users = mapper.readValue(response.body(),
LdapUserParser.class);
for (User user : users.getData().getUsers()) {
UserModel existingUser = userService.getUserIdByName(user.getId());
if (existingUser != null) {
existingUser.userId = user.getId();
existingUser.email = user.getEmail();
existingUser.displayName = user.getDisplayName();
existingUser.firstName = user.getFirstName();
existingUser.lastName = user.getLastName();
existingUser.creationDate = user.getCreationDate();
existingUser.avatar = user.getAvatar();
existingUser.sshKeys = user.getSshKeys();
userService.updateUser(existingUser);
} else {
userService.addUser(new UserModel(user.getId(), user.getEmail(), user.getDisplayName(),
user.getFirstName(),
user.getLastName(), user.getCreationDate(), user.getAvatar(), user.getSshKeys()));
}
}
if (response.statusCode() != 200) {
return Response.status(response.statusCode()).build();
}
return Response.ok(users).build();
} catch (JsonProcessingException e) {
e.printStackTrace();
return Response.status(500).build();
}
}
}

View File

@ -0,0 +1,29 @@
package fr.la_banquise.backend.api;
import java.util.ArrayList;
import java.util.List;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
/**
* Dashboard
*/
@Path("/api")
public class Dashboard {
@GET
@RolesAllowed("user")
@Path("/dashboard")
@Produces(MediaType.APPLICATION_JSON)
public Response getDashboard() {
List<String> tp = new ArrayList<>();
tp.add("Bot Discord");
tp.add("Websocket Chat");
return Response.ok(tp).build();
}
}

View File

@ -0,0 +1,10 @@
package fr.la_banquise.backend.api.response;
import java.util.List;
/**
* DataLdap
*/
public class DataLdap {
private List<UserLdap> users;
}

View File

@ -0,0 +1,102 @@
package fr.la_banquise.backend.api.response;
import java.util.List;
/**
* LdapUserParser
*/
public class LdapUserParser {
public static class User {
private String id;
private String email;
private String displayName;
private String firstName;
private String lastName;
private String creationDate;
private String avatar;
private List<String> sshKeys;
// Getters and Setters
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getCreationDate() {
return creationDate;
}
public void setCreationDate(String creationDate) {
this.creationDate = creationDate;
}
public String getAvatar() {
return avatar;
}
public List<String> getSshKeys() {
return sshKeys;
}
}
public static class Data {
private List<User> users;
// Getter and Setter
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
}
private Data data;
// Getter and Setter
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
}

View File

@ -0,0 +1,13 @@
package fr.la_banquise.backend.api.response;
/**
* UserLdap
*/
public class UserLdap {
private String id;
private String email;
private String displayName;
private String firstName;
private String lastName;
private String creationDate;
}

View File

@ -0,0 +1,10 @@
package fr.la_banquise.backend.api.response;
import java.util.List;
/**
* UserLdapResponse
*/
public class UserLdapResponse {
private DataLdap data;
}

View File

@ -0,0 +1,13 @@
package fr.la_banquise.backend.converter;
import fr.la_banquise.backend.data.model.TpModel;
import fr.la_banquise.backend.domain.entity.TpItemEntity;
/**
* Mapper
*/
public class Mapper {
public static TpItemEntity toTpEntity(TpModel tp) {
return new TpItemEntity(tp.id, tp.name, tp.description, tp.pdfLink, tp.givenLink, tp.respo, tp.endDate);
}
}

View File

@ -0,0 +1,38 @@
package fr.la_banquise.backend.data.model;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* TpModel
*/
@Entity
@Table(name = "tps")
public class TpModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpModel(String name, String description, String pdfLink, String givenLink, String respo, String endDate) {
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
public TpModel() {
}
}

View File

@ -0,0 +1,44 @@
package fr.la_banquise.backend.data.model;
import java.util.List;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* UserModel
*/
@Entity
@Table(name = "users")
public class UserModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
public String userId;
public String email;
public String displayName;
public String firstName;
public String lastName;
public String creationDate;
public String avatar;
public List<String> sshKeys;
public UserModel(String userId, String email, String displayName, String firstName, String lastName,
String creationDate, String avatar,
List<String> sshKeys) {
this.userId = userId;
this.email = email;
this.displayName = displayName;
this.firstName = firstName;
this.lastName = lastName;
this.creationDate = creationDate;
this.avatar = avatar;
this.sshKeys = sshKeys;
}
public UserModel() {
}
}

View File

@ -0,0 +1,12 @@
package fr.la_banquise.backend.data.repository;
import fr.la_banquise.backend.data.model.TpModel;
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import jakarta.enterprise.context.ApplicationScoped;
/**
* TpRepository
*/
@ApplicationScoped
public class TpRepository implements PanacheRepository<TpModel> {
}

View File

@ -0,0 +1,12 @@
package fr.la_banquise.backend.data.repository;
import fr.la_banquise.backend.data.model.UserModel;
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import jakarta.enterprise.context.ApplicationScoped;
/**
* UserRepository
*/
@ApplicationScoped
public class UserRepository implements PanacheRepository<UserModel> {
}

View File

@ -0,0 +1,13 @@
package fr.la_banquise.backend.domain.entity;
import java.util.Set;
/**
* DashboardEntity
*/
public class DashboardEntity {
public Set<TpItemEntity> tps;
public Set<DashboardItem> instances;
public Set<DashboardItem> messages;
public String userName;
}

View File

@ -0,0 +1,11 @@
package fr.la_banquise.backend.domain.entity;
/**
* DashboardItem
*/
public class DashboardItem {
public Long id;
public String name;
public String description;
public String link;
}

View File

@ -0,0 +1,24 @@
package fr.la_banquise.backend.domain.entity;
/**
* TpItemEntity
*/
public class TpItemEntity {
public Long id;
public String name;
public String description;
public String pdfLink;
public String givenLink;
public String respo;
public String endDate;
public TpItemEntity(Long id, String name, String description,String pdfLink, String givenLink, String respo, String endDate) {
this.id = id;
this.name = name;
this.description = description;
this.pdfLink = pdfLink;
this.givenLink = givenLink;
this.respo = respo;
this.endDate = endDate;
}
}

View File

@ -0,0 +1,27 @@
package fr.la_banquise.backend.domain.entity;
import java.util.List;
/**
* UserEntity
*/
public class UserEntity {
public Long id;
public String userId;
public String displayName;
public String firstName;
public String lastName;
public String avatar;
public List<String> sshKeys;
public UserEntity(String userId, String displayName, String firstName, String lastName, String avatar,
List<String> sshKeys) {
this.userId = userId;
this.displayName = displayName;
this.firstName = firstName;
this.lastName = lastName;
this.avatar = avatar;
this.sshKeys = sshKeys;
}
}

View File

@ -0,0 +1,48 @@
package fr.la_banquise.backend.domain.service;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import fr.la_banquise.backend.converter.Mapper;
import fr.la_banquise.backend.data.model.TpModel;
import fr.la_banquise.backend.data.repository.TpRepository;
import fr.la_banquise.backend.domain.entity.TpItemEntity;
import fr.la_banquise.backend.presentation.rest.request.TpForm;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.transaction.Transactional;
/**
* DashboardItemService
*/
@ApplicationScoped
public class DashboardItemService {
@Inject
EntityManager em;
@Inject
TpRepository tpRepository;
public Set<TpItemEntity> getTps(){
Set<TpModel> tpModels = tpRepository.findAll().stream().collect(Collectors.toSet());
Set<TpItemEntity> res = new HashSet<>();
tpModels.forEach(tp -> {
res.add(Mapper.toTpEntity(tp));
});
return res;
}
public TpItemEntity getTp(long id){
TpModel tp = tpRepository.findById(id);
return Mapper.toTpEntity(tp);
}
@Transactional
public TpItemEntity newTp(TpForm tp){
TpModel newTp = new TpModel(tp.title, tp.description, tp.pdflink, tp.givenlink, tp.respo, tp.date);
em.persist(newTp);
return Mapper.toTpEntity(newTp);
}
}

View File

@ -0,0 +1,45 @@
package fr.la_banquise.backend.domain.service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import fr.la_banquise.backend.data.model.UserModel;
import fr.la_banquise.backend.data.repository.UserRepository;
import fr.la_banquise.backend.domain.entity.UserEntity;
import io.quarkus.hibernate.orm.panache.PanacheEntity;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.transaction.Transactional;
/**
* UserService
*/
@ApplicationScoped
public class UserService {
@Inject
EntityManager em;
@Inject
UserRepository userRepository;
public List<UserModel> getUsers() {
return userRepository.listAll();
}
public UserModel getUserIdByName(String userId) {
return userRepository.find("userId", userId.toString()).firstResult();
}
@Transactional
public void addUser(UserModel user) {
userRepository.persist(user);
}
@Transactional
public void updateUser(UserModel user) {
userRepository.getEntityManager().merge(user);
}
}

View File

@ -0,0 +1,26 @@
package fr.la_banquise.backend.presentation.resources;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateInstance;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* AdminResource
*/
@Path("admin")
public class AdminResource {
@Inject
Template admin;
@GET
@Produces(MediaType.TEXT_HTML)
@RolesAllowed("admin")
public TemplateInstance admin(){
return admin.data("", "");
}
}

View File

@ -0,0 +1,43 @@
package fr.la_banquise.backend.presentation.resources;
import java.util.Set;
import fr.la_banquise.backend.domain.entity.DashboardEntity;
import fr.la_banquise.backend.domain.entity.TpItemEntity;
import fr.la_banquise.backend.domain.service.DashboardItemService;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateInstance;
import io.quarkus.security.Authenticated;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.SecurityContext;
/**
* DashboardResource
*/
@Path("dashboard")
@Authenticated
public class DashboardResource {
@Inject
Template dashboard;
@Inject
DashboardItemService dashboardItemService;
@GET
@Produces(MediaType.TEXT_HTML)
public TemplateInstance dashboard(@Context SecurityContext securityContext){
Set<TpItemEntity> tps = dashboardItemService.getTps();
var dash = new DashboardEntity();
dash.tps = tps;
var user = securityContext.getUserPrincipal();
dash.userName = user.getName();
return dashboard.data(dash);
}
}

View File

@ -0,0 +1,36 @@
package fr.la_banquise.backend.presentation.resources;
import fr.la_banquise.backend.domain.entity.TpItemEntity;
import fr.la_banquise.backend.domain.service.DashboardItemService;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateInstance;
import io.quarkus.security.Authenticated;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* TpResource
*/
@Path("/tps")
public class TpResource {
@Inject
Template tp;
@Inject
DashboardItemService dashboardItemService;
@Path("/{id}")
@GET
@Authenticated
@Produces(MediaType.TEXT_HTML)
public TemplateInstance tp(@PathParam("id") long id){
// if not available 404
// load it from db
TpItemEntity tpItem = dashboardItemService.getTp(id);
return tp.data(tpItem);
}
}

View File

@ -0,0 +1,28 @@
package fr.la_banquise.backend.presentation.rest;
import fr.la_banquise.backend.domain.service.DashboardItemService;
import fr.la_banquise.backend.presentation.rest.request.TpForm;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
/**
* ApiEndpoints
*/
@Path("/api")
public class ApiEndpoints {
@Inject
DashboardItemService dashboardItemService;
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/tp")
public Response newTp(TpForm tp){
var newTp = dashboardItemService.newTp(tp);
return Response.ok(newTp).build();
}
}

View File

@ -0,0 +1,21 @@
package fr.la_banquise.backend.presentation.rest.request;
import jakarta.ws.rs.FormParam;
/**
* TpForm
*/
public class TpForm {
@FormParam(value = "title")
public String title;
@FormParam(value = "description")
public String description;
@FormParam(value = "pdflink")
public String pdflink;
@FormParam(value = "givenlink")
public String givenlink;
@FormParam(value = "respo")
public String respo;
@FormParam(value = "date")
public String date;
}

View File

@ -0,0 +1,10 @@
package fr.la_banquise.backend.utils;
/**
* Ldap
*/
public class Ldap {
public String getBearer() {
return "";
}
}

View File

@ -0,0 +1,68 @@
package fr.la_banquise.backend.utils;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.vertx.core.json.JsonObject;
/**
* RequestsHttp
*/
public class RequestsHttp {
public static String call(String url, String body) {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.POST(HttpRequest.BodyPublishers.ofString(body))
.header("Content-Type", "application/json")
.build();
HttpResponse<String> response;
try {
response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response.body();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
return "";
}
public static HttpResponse<String> callLdap(String url, String body) {
String responseBearer = call("http://localhost:17170/auth/simple/login",
"{\"username\": \"ldap_ro\", \"password\": \"qwertyuiop\"}");
ObjectMapper objectMapper = new ObjectMapper();
String bearer = "";
try {
System.out.println(responseBearer);
JsonNode jsonNode = objectMapper.readTree(responseBearer);
bearer = jsonNode.get("token").asText();
} catch (JsonProcessingException e) {
e.printStackTrace();
}
// TODO store jwt in db + refresh token and handle that later on
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.POST(HttpRequest.BodyPublishers.ofString(body))
.header("Content-Type", "application/json")
.header("Authorization",
"Bearer " + bearer)
.build();
HttpResponse<String> response;
try {
response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response;
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
return null;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,41 @@
# quarkus.oidc.application-type=web-app
# quarkus.oidc.auth-server-url=https://localhost:8543/realms/myrealm
# # quarkus.oidc.auth-server-url=https://localhost:8543/realms/testhere
# quarkus.oidc.client-id=myclient
# quarkus.oidc.credentials.secret=s6Tjtjap9OIE1CoSUbqe4f972SSDq0o9
# quarkus.oidc.tls.verification=none
# quarkus.oidc.roles.source=accesstoken
# quarkus.oidc.token.refresh-expired=true
# quarkus.oidc.token-cache.max-size=1000
quarkus.security.ldap.enabled=true
quarkus.http.auth.form.enabled=true
quarkus.http.auth.basic=true
quarkus.http.auth.session.encryption-key=DC0wK2TMAwQdK2A88RSJ9j7Iae3wxy2RAjPgoCL6sOLnLpV4MhOY9leRldkkgepw
quarkus.security.ldap.dir-context.principal=uid=admin,ou=people,dc=example,dc=com
quarkus.security.ldap.dir-context.url=ldap://localhost:3890
quarkus.security.ldap.dir-context.password=password
quarkus.http.auth.form.login-page=/login
quarkus.http.auth.form.landing-page=hello
quarkus.security.ldap.identity-mapping.rdn-identifier=uid
quarkus.security.ldap.identity-mapping.search-base-dn=ou=people,dc=example,dc=com
quarkus.security.ldap.identity-mapping.attribute-mappings."0".from=cn
quarkus.security.ldap.identity-mapping.attribute-mappings."0".filter=(member=uid={0},ou=people,dc=example,dc=com)
quarkus.security.ldap.identity-mapping.attribute-mappings."0".filter-base-dn=ou=groups,dc=example,dc=com
%test.quarkus.security.ldap.dir-context.url=ldap://127.0.0.1:10389
quarkus.quinoa.dev-server.port=5173
# database
quarkus.datasource.db-kind = postgresql
quarkus.datasource.username = postgres
quarkus.datasource.password = secret
quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/quarkus
# drop and create the database at startup (use `update` to only update the schema)drop-and-create
quarkus.hibernate-orm.database.generation=update

View File

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100">
<div class="container mx-auto p-6">
<h1 class="text-4xl font-bold text-center text-gray-800 mb-8">Admin Dashboard</h1>
<div class="flex mb-4">
<button onclick="openTab('practicalTab')" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l">New Practical</button>
<button onclick="openTab('instanceTab')" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4">New Instance</button>
<button onclick="openTab('messageTab')" class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-r">New Message</button>
</div>
<div id="practicalTab" class="tab-content bg-white shadow-lg rounded-lg p-6 hidden">
<h2 class="text-2xl font-bold text-gray-700 mb-4">Create New Practical</h2>
<form id="practicalForm">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="practicalTitle" class="block text-gray-700 mb-2">Title</label>
<input type="text" id="practicalTitle" name="title" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter title">
</div>
<div>
<label for="practicalDescription" class="block text-gray-700 mb-2">Description</label>
<input id="practicalDescription" name="description" class="w-full p-2 border border-gray-300 rounded mb-4" rows="4" placeholder="Enter description">
</div>
<div>
<label for="instancePdfLink" class="block text-gray-700 mb-2">Pdf Link</label>
<input type="text" id="instancePdfLink" name="pdflink" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter pdf link">
</div>
<div>
<label for="instanceGivenLink" class="block text-gray-700 mb-2">Given Files Link</label>
<input type="text" id="instanceGivenLink" name="givenlink" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter the given files link">
</div>
<div>
<label for="instanceRespo" class="block text-gray-700 mb-2">Respo</label>
<input type="text" id="instanceRespo" name="respo" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter Respo">
</div>
<div>
<label for="instanceEndDate" class="block text-gray-700 mb-2">Date</label>
<input type="text" id="instanceEndDate" name="date" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter Date">
</div>
</div>
<button type="button" onclick="submitForm()" class="w-full px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-700">Create</button>
</form>
</div>
<div id="instanceTab" class="tab-content bg-white shadow-lg rounded-lg p-6 hidden">
<h2 class="text-2xl font-bold text-gray-700 mb-4">Create New Instance</h2>
<form action="http://localhost:8080/api/tp" method="POST">
<label for="instanceTitle" class="block text-gray-700 mb-2">Title</label>
<input type="text" id="instanceTitle" name="title" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter title">
<label for="instanceDescription" class="block text-gray-700 mb-2">Description</label>
<textarea id="instanceDescription" name="description" class="w-full p-2 border border-gray-300 rounded mb-4" rows="4" placeholder="Enter description"></textarea>
<button type="submit" class="w-full px-4 py-2 bg-green-500 text-white rounded hover:bg-green-700">Create</button>
</form>
</div>
<div id="messageTab" class="tab-content bg-white shadow-lg rounded-lg p-6 hidden">
<h2 class="text-2xl font-bold text-gray-700 mb-4">Create New Message</h2>
<form action="http://localhost:8080/api/tp" method="POST">
<label for="messageTitle" class="block text-gray-700 mb-2">Title</label>
<input type="text" id="messageTitle" name="title" class="w-full p-2 border border-gray-300 rounded mb-4" placeholder="Enter title">
<label for="messageContent" class="block text-gray-700 mb-2">Content</label>
<textarea id="messageContent" name="content" class="w-full p-2 border border-gray-300 rounded mb-4" rows="4" placeholder="Enter content"></textarea>
<button type="submit" class="w-full px-4 py-2 bg-red-500 text-white rounded hover:bg-red-700">Create</button>
</form>
</div>
<div class="bg-white shadow-lg rounded-lg p-6 mt-6">
<h2 class="text-2xl font-bold text-gray-700 mb-4">Other Functionalities</h2>
<p class="text-gray-600">You can add more admin functionalities here.</p>
</div>
</div>
<script>
function submitForm() {
var formData = {
title: document.getElementById("practicalTitle").value,
description: document.getElementById("practicalDescription").value,
pdflink: document.getElementById("instancePdfLink").value,
givenlink: document.getElementById("instanceGivenLink").value,
respo: document.getElementById("instanceRespo").value,
date: document.getElementById("instanceEndDate").value
};
fetch('http://localhost:8080/api/tp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => {
console.log('Form submitted successfully');
document.getElementById("practicalForm").reset();
})
.catch(error => {
alert(error)
console.error('Error occurred while submitting form:', error);
});
}
function openTab(tabName) {
var i, tabContent;
tabContent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabContent.length; i++) {
tabContent[i].classList.add("hidden");
}
document.getElementById(tabName).classList.remove("hidden");
}
</script>
</body>
</html>

View File

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="min-h-screen bg-gray-100">
<header class="w-full text-center pt-20">
<h2 class="text-4xl font-bold text-center text-blue-500 mb-8">WELCOME {userName}!</h2>
</header>
<main class="w-full flex-grow grid grid-cols-1 lg:grid-cols-3 gap-6 p-8">
<section class="bg-white p-6 rounded-lg shadow-lg h-full">
<h2 class="text-2xl font-bold mb-4">Practicals</h2>
<div class="space-y-6">
{#if tps.orEmpty.size == 0}
<div class="h-full">
<p class="text-gray-700">You have no practicals</p>
</div>
{/if}
{#for tp in tps}
<a href="/tps/{tp.id}" class="block p-6 bg-gray-200 rounded-lg shadow-md hover:bg-gray-300">
<h3 class="text-xl font-semibold">{tp.name}</h3>
<p class="text-gray-700">{tp.description}</p>
</a>
{/for}
</div>
</section>
<section class="bg-white p-6 rounded-lg shadow-lg h-full">
<h2 class="text-2xl font-bold mb-4">Instances</h2>
<div class="space-y-6">
{#if instances == null }
<div class="h-full">
<p class="text-gray-700">You have no instances</p>
</div>
{/if}
{#for instance in instances}
<a href={instance.link} class="block p-6 bg-gray-200 rounded-lg shadow-md hover:bg-gray-300">
<h3 class="text-xl font-semibold">{instance.name}</h3>
<p class="text-gray-700">{instance.description}</p>
</a>
{/for}
</section>
<section class="bg-white p-6 rounded-lg shadow-lg h-full">
<h2 class="text-2xl font-bold mb-4">Messages</h2>
<div class="space-y-6">
{#if messages == null }
<div class="h-full">
<p class="text-gray-700">You have no messages</p>
</div>
{/if}
{#for message in messages}
<a href={message.link} class="block p-6 bg-gray-200 rounded-lg shadow-md hover:bg-gray-300">
<h3 class="text-xl font-semibold">{message.name}</h3>
<p class="text-gray-700">{message.description}</p>
</a>
{/for}
</section>
</main>
</body>
</html>

View File

@ -0,0 +1 @@
Hello {name}!

View File

@ -0,0 +1 @@
<h1>hello</h1>

View File

@ -0,0 +1 @@
<h1>Hello {http:param('name', 'Quarkus')}!</h1>

View File

@ -0,0 +1 @@
<h1>Hello</h1>

View File

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Form</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100 h-screen flex flex-col justify-center items-center">
<img src="logo.png" width="200" height="100" alt="Example Image">
<h2 class="text-3xl mb-4">Login</h2>
<form id="loginForm" class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4 w-80">
<div class="mb-4">
<label for="username" class="block text-gray-700 text-sm font-bold mb-2">Username:</label>
<input type="text" id="username" name="username"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="mb-6">
<label for="password" class="block text-gray-700 text-sm font-bold mb-2">Password:</label>
<input type="password" id="password" name="password"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div id="errorMessage" class="text-red-500 mx-auto my-4 hidden text-center">Invalid credentials</div>
<div class="flex flex-col justify-center items-center">
<input type="submit" value="Login"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
</div>
</form>
<!--<button id="logoutButton" class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">Logout</button>-->
<script>
const login = () => {
const formData = new URLSearchParams();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
formData.append("j_username", username);
formData.append("j_password", password);
const errorMessage = document.getElementById('errorMessage');
fetch("j_security_check", {
method: "POST",
body: formData,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
})
.then((response) => {
if (response.status === 200) {
console.log(response);
if (response.redirected) {
window.location.href = response.url;
console.log("oui");
}
else {
window.location.href = "/user";
}
} else {
errorMessage.classList.remove('hidden');
}
})
.catch((error) => {
console.error(error);
});
};
const logout = () => {
document.cookie = `quarkus-credential=; Max-Age=0;path=/`;
window.location.href = "login";
// Perform post-logout actions here, such as redirecting back to your login page
};
document.getElementById("loginForm").addEventListener("submit", function (event) {
event.preventDefault(); // Prevent the default form submission
login(); // Call the login function
});
document.getElementById("logoutButton").addEventListener("click", function () {
logout(); // Call the logout function when the logout button is clicked
});
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<form id="loginForm">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Login</button>
</form>
<script>
document.getElementById('loginForm').addEventListener('submit', async (event) => {
event.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
const formData = new URLSearchParams();
formData.append('client_id', 'myclient');
formData.append('grant_type', 'password');
formData.append('username', username);
formData.append('password', password);
formData.append('client_secret', 'H5BS5BsEmrVZEYlUUHHz04nJrgKhkhxk');
const response = await fetch('https://localhost:8543/realms/myrealm/protocol/openid-connect/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: formData
});
if (response.ok) {
const data = await response.json();
const token = data.access_token;
console.log(token)
document.cookie = "jwt=" + token + "; HttpOnly; Secure; Path=/";
const aaaa = await fetch('/api/admin', {
method: 'GET',
});
// window.location.href = '/home';
} else {
alert('Login failed');
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Practical Details</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
<div class="h-screen">
<div class="p-8">
<div class="flex flex-1 items-stretch justify-between px-4">
<h1 class="text-4xl font-bold text-center text-blue-500 mb-4">{name}</h1>
<div class="relative ml-3 mb-4">
<button id="profile-dropdown-button-breadcrumb" type="button" class="relative flex rounded-full bg-gray-800 text-sm focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800" aria-expanded="false">
<span class="absolute -inset-1.5"></span>
<span class="sr-only">Open user menu</span>
<img class="h-10 w-10 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="">
</button>
<div id="profile-dropdown-breadcrumb" class="dropdown-enter hidden absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<a href="#" class="block px-4 py-2 text-sm text-gray-700" role="menuitem">Profile</a>
<a href="#" id="logout-button" class="block px-4 py-2 text-sm text-gray-700" role="menuitem">Sign out</a>
</div>
</div>
</div>
<nav class="bg-gray-100 p-3 rounded-md w-full flex justify-between items-center">
<ol class="list-reset flex">
<li><a href="#" class="text-blue-600 hover:text-blue-700">Home</a></li>
<li><span class="mx-2 text-gray-500">/</span></li>
<li><a href="#" class="text-blue-600 hover:text-blue-700">Library</a></li>
<li><span class="mx-2 text-gray-500">/</span></li>
<li><a href="#" class="text-blue-600 hover:text-blue-700">Data</a></li>
<li><span class="mx-2 text-gray-500">/</span></li>
<li class="text-gray-500">{id}</li>
</ol>
</nav>
</div>
<div class="lg:grid lg:grid-cols-2 w-full h-4/5 p-8 lg:gap-20">
<div class=" flex items-center justify-center lg:h-full h-4/6">
<iframe src="{pdfLink}" class="ps-8 w-full h-full aspect-video"></iframe>
</div>
<div class="lg:p-12 p-6 lg:mt-0 mt-4">
<div>
<h1 class="text-4xl font-bold mb-6">Informations</h1>
<p class="ml-4 text-xl text-gray-700">Responsable: {respo}</p>
<p class="ml-4 text-xl text-gray-700">Date de fin: {endDate}</p>
</div>
<div class="mt-4">
<h1 class="text-4xl font-bold mb-6">Resources</h1>
<p class="ml-4 text-xl text-gray-700">acces SSH: ssh todo</p>
<p class="ml-4 text-xl text-gray-700">mot de passe: pwd todo</p>
</div>
<a href="{pdfLink}" target="_blank" class="mt-8 bg-gray-100 rounded-lg shadow-md p-6 flex items-center justify-between">
<div>
<div class="text-xl text-gray-900">Subject</div>
<p class="text-gray-900">Download</p>
</div>
<svg class="h-6 w-6 flex-shrink-0 text-gray-900" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
</a>
{#if givenLink != ''}
<a href="{givenLink}" class="mt-4 bg-gray-100 rounded-lg shadow-md p-6 flex items-center justify-between">
<div>
<div class="text-xl text-gray-900">Given files</div>
<p class="text-gray-900">Download</p>
</div>
<svg class="h-6 w-6 flex-shrink-0 text-gray-900" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
</a>
{/if}
</div>
</div>
<script defer>
document.addEventListener('DOMContentLoaded', function() {
const profileButton = document.getElementById('profile-dropdown-button-breadcrumb');
const dropdownMenu = document.getElementById('profile-dropdown-breadcrumb');
const logoutButton = document.getElementById('logout-button');
profileButton.addEventListener('click', function(event) {
dropdownMenu.classList.toggle('hidden');
dropdownMenu.classList.toggle('transition', 'ease-out', 'duration-100', 'transform', 'opacity-0', 'scale-95');
dropdownMenu.classList.toggle('transition', 'ease-in', 'duration-75', 'transform', 'opacity-100', 'scale-100');
event.stopPropagation();
});
logoutButton.addEventListener('click', function(event) {
window.location.replace("https://localhost:8543/realms/myrealm/protocol/openid-connect/logout");
});
document.addEventListener('click', function() {
if (!dropdownMenu.classList.contains('hidden')) {
dropdownMenu.classList.add('hidden');
}
});
dropdownMenu.addEventListener('click', function(event) {
event.stopPropagation();
});
});
</script>
</body>
</html>