Skip to content

Commit

Permalink
feat: tomcat 10, spring 6 without oauth2 yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Jan 14, 2024
1 parent 329bd27 commit ccfb7ef
Show file tree
Hide file tree
Showing 68 changed files with 574 additions and 280 deletions.
8 changes: 5 additions & 3 deletions arc-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${project.maven.compiler.version}</version>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<source>${project.java.version}</source>
<target>${project.java.version}</target>
<release>${project.java.version}</release>
<compilerArgs>
<arg>-parameters</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>

Expand Down
5 changes: 4 additions & 1 deletion arc-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${project.maven.compiler.version}</version>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<release>${project.java.version}</release>
<compilerArgs>
<arg>-parameters</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
Expand Down
15 changes: 4 additions & 11 deletions arc-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${project.maven.compiler.version}</version>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<release>${project.java.version}</release>
<compilerArgs>
<arg>-parameters</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
Expand All @@ -47,12 +50,6 @@
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0-b01</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
Expand All @@ -63,10 +60,6 @@
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-security-adapter</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.List;
import java.util.Map;

import javax.swing.text.AbstractDocument.LeafElement;

/**
* Transform a relation into a hierarchy (tree or forest), enable its manipulation through hierarchical methods. <br/>
*
Expand Down Expand Up @@ -135,7 +133,7 @@ public static final HierarchicalView asChild(String aName, HierarchicalView aPar
/**
* Load columns of a {@code aRelationalView} into a hierarchichal view, constrained by {@code aColumnList}.
*
* The nth {@link LeafElement} of a {@code aColumnList} is taken as the name of the nth column of {@code aRelationalView}.
* The nth of a {@code aColumnList} is taken as the name of the nth column of {@code aRelationalView}.
*
* @param aRootName
* @param aColumnList
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
package fr.insee.arc.utils.webutils;

import java.io.IOException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.keycloak.adapters.KeycloakDeploymentBuilder;
import org.keycloak.representations.adapters.config.AdapterConfig;
import org.springframework.core.io.ClassPathResource;

import fr.insee.arc.utils.utils.LoggerHelper;

// TODO
public class WebSecurity {
private static final Logger LOGGER = LogManager.getLogger(WebSecurity.class);

Expand All @@ -21,16 +15,16 @@ private WebSecurity() {
private static final String ENV_VAR_PREFIX="${";
private static final String ENV_VAR_SUFFIX="}";

public static boolean isKeycloackOverloaded(AdapterConfig adapterConfig)
{
LoggerHelper.infoAsComment(LOGGER, "Keycloak classpath configuration overload");
LoggerHelper.infoAsComment(LOGGER, "keycloak adapterConfig.getRealm() : "+adapterConfig.getRealm());
LoggerHelper.infoAsComment(LOGGER, "keycloak adapterConfig.getAuthServerUrl() : "+adapterConfig.getAuthServerUrl());
return isOverloaded(adapterConfig.getRealm())
&& isOverloaded(adapterConfig.getAuthServerUrl())
;
}

// public static boolean isKeycloackOverloaded(AdapterConfig adapterConfig)
// {
// LoggerHelper.infoAsComment(LOGGER, "Keycloak classpath configuration overload");
// LoggerHelper.infoAsComment(LOGGER, "keycloak adapterConfig.getRealm() : "+adapterConfig.getRealm());
// LoggerHelper.infoAsComment(LOGGER, "keycloak adapterConfig.getAuthServerUrl() : "+adapterConfig.getAuthServerUrl());
// return isOverloaded(adapterConfig.getRealm())
// && isOverloaded(adapterConfig.getAuthServerUrl())
// ;
// }
//
/**
* check if the value should be overloaded by an environment value
* @param myValue
Expand All @@ -57,26 +51,26 @@ public static boolean isKeycloakFileConfigurationActive(String keycloakFile) {
* 2- the parameters in the classpath had been well overloaded by environment variables
* @return
*/
public static boolean isKeycloakResourceConfigurationActive(String keycloakResource) {
// resource empty ? false
if (keycloakResource.isEmpty()) {return false;}

// ressource well built ? true else false
try {
return isKeycloackOverloaded(
KeycloakDeploymentBuilder.loadAdapterConfig(new ClassPathResource(keycloakResource).getInputStream()));
} catch (IOException e) {
return false;
}
}
// public static boolean isKeycloakResourceConfigurationActive(String keycloakResource) {
// // resource empty ? false
// if (keycloakResource.isEmpty()) {return false;}
//
// // ressource well built ? true else false
// try {
// return isKeycloackOverloaded(
// KeycloakDeploymentBuilder.loadAdapterConfig(new ClassPathResource(keycloakResource).getInputStream()));
// } catch (IOException e) {
// return false;
// }
// }

/**
* Returns true if Keycloak authentification should be used.
* Keycloak is active if one of the ressource or file configuration is active
* @return
*/
public static boolean isKeycloakActive(String keycloakFile, String keycloakResource) {
return isKeycloakFileConfigurationActive(keycloakFile) || isKeycloakResourceConfigurationActive(keycloakResource);
}
// public static boolean isKeycloakActive(String keycloakFile, String keycloakResource) {
// return isKeycloakFileConfigurationActive(keycloakFile) || isKeycloakResourceConfigurationActive(keycloakResource);
// }

}
48 changes: 29 additions & 19 deletions arc-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0-M1</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -130,11 +131,15 @@
<artifactId>spring-security-config</artifactId>
</dependency>

<!-- Keycloak -->
<!-- oauth2 Keycloak -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-security-adapter</artifactId>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
Expand All @@ -149,11 +154,22 @@
<version>2.8.0</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.0</version>
</dependency>



<dependency>
Expand All @@ -167,13 +183,7 @@
<artifactId>jackson-core</artifactId>
<version>${project.jackson.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${project.jackson.version}</version>
</dependency>


</dependencies>

<build>
Expand Down
Loading

0 comments on commit ccfb7ef

Please sign in to comment.