GH-242: Remove jasypt dependency

Fixes https://github.com/spring-projects/spring-integration-samples/issues/242

Since `jasypt` is not compatible with Spring Security and recommendation
is to use BCrypt or NO-OP instead, remove its dependency and appropriate
bean definitions in favor of NO-OP password encoding.
The purpose of this `http-rest` application is out of Spring Security
encoding capabilities
This commit is contained in:
Artem Bilan
2019-02-19 12:54:01 -05:00
parent 7ed9f59844
commit a2bdf20551
5 changed files with 20 additions and 75 deletions

View File

@@ -191,7 +191,6 @@ subprojects { subproject ->
hsqldbVersion = '2.3.2' hsqldbVersion = '2.3.2'
h2Version = '1.4.194' h2Version = '1.4.194'
jacksonVersion = '2.9.8' jacksonVersion = '2.9.8'
jasyptVersion = '1.7'
javaxInjectVersion = '1' javaxInjectVersion = '1'
javaxMailVersion = '1.5.5' javaxMailVersion = '1.5.5'
jodaTimeVersion = '1.6' jodaTimeVersion = '1.6'
@@ -1149,7 +1148,6 @@ project('rest-http') {
compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
compile "org.springframework.security:spring-security-web:$springSecurityVersion" compile "org.springframework.security:spring-security-web:$springSecurityVersion"
compile "org.springframework.security:spring-security-config:$springSecurityVersion" compile "org.springframework.security:spring-security-config:$springSecurityVersion"
compile "org.jasypt:jasypt:$jasyptVersion"
compile "org.apache.logging.log4j:log4j-core:$log4jVersion" compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
} }

View File

@@ -165,18 +165,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.7</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>

View File

@@ -1,2 +1 @@
#REST HTTP User - Password is 'spring' SPRING={noop}spring,ROLE_REST_HTTP_USER,enabled
SPRING=gI/OZ3yejUtSxsF9XySg5TfFJFo=,ROLE_REST_HTTP_USER,enabled

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans/spring-beans.xsd
@@ -11,40 +12,17 @@
secured-annotations="enabled" /> secured-annotations="enabled" />
<!-- Configure Spring Security --> <!-- Configure Spring Security -->
<security:http auto-config="true" use-expressions="true" realm="REST HTTP Web Service" create-session="never"> <security:http use-expressions="true" realm="REST HTTP Web Service" create-session="never">
<security:http-basic /> <security:http-basic />
<security:form-login />
<security:intercept-url pattern='/services/employee/*' access="hasRole('ROLE_REST_HTTP_USER')" /> <security:intercept-url pattern='/services/employee/*' access="hasRole('ROLE_REST_HTTP_USER')" />
</security:http> </security:http>
<!-- In this example, we are using in memory authentication. The password encoder depends on <!-- In this example, we are using in memory authentication. -->
Jasypt's String Digester to digest the password stored in users.properties -->
<security:authentication-manager alias="authenticationManager"> <security:authentication-manager alias="authenticationManager">
<security:authentication-provider> <security:authentication-provider>
<security:password-encoder ref="passwordEncoder"/>
<security:user-service properties="classpath:users.properties" /> <security:user-service properties="classpath:users.properties" />
</security:authentication-provider> </security:authentication-provider>
</security:authentication-manager> </security:authentication-manager>
<!--
Use the StringDigester to create uni-directional password encryption.
All uni-directional encryption methods supported in jasypt is integrated into
Spring Security
-->
<bean id="jasyptStringDigester" class="org.jasypt.digest.StandardStringDigester" >
<property name="algorithm" value="SHA-1" />
<property name="iterations" value="100000" />
<property name="saltGenerator">
<bean id="zeroSaltGenerator" class="org.jasypt.salt.ZeroSaltGenerator"/>
</property>
<property name="saltSizeBytes" value="10"/>
</bean>
<!--
This Spring Security-friendly PasswordEncoder implementation will
wrap the StringDigester instance so that it can be used from
the security framework.
-->
<bean id="passwordEncoder" class="org.jasypt.spring.security3.PasswordEncoder">
<property name="stringDigester" ref="jasyptStringDigester"/>
</bean>
</beans> </beans>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" <web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="2.5"> version="3.0">
<display-name>Spring Integration Rest HTTP Path Usage Demo</display-name> <display-name>Spring Integration Rest HTTP Path Usage Demo</display-name>
@@ -32,24 +32,6 @@
<param-value>/WEB-INF/classes/log4j.properties</param-value> <param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param> </context-param>
<!--
- Configures Log4J for this web app.
- As this context specifies a context-param "log4jConfigLocation", its file path
- is used to load the Log4J configuration, including periodic refresh checks.
-
- Would fall back to default Log4J initialization (non-refreshing) if no special
- context-params are given.
-
- Exports a "web app root key", i.e. a system property that specifies the root
- directory of this web app, for usage in log file paths.
- This web app specifies "rest-http.root" (see log4j.properties file).
-->
<!-- Leave the listener commented-out if using JBoss -->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- <!--
- Loads the root application context of this web app at startup, - Loads the root application context of this web app at startup,
- by default from "/WEB-INF/applicationContext.xml". - by default from "/WEB-INF/applicationContext.xml".