--- a/server/src/main/java/org/iri_research/renkan/controller/admin/UsersAdminController.java Fri Oct 25 16:34:05 2013 +0200
+++ b/server/src/main/java/org/iri_research/renkan/controller/admin/UsersAdminController.java Mon Oct 28 18:20:56 2013 +0100
@@ -5,6 +5,8 @@
import java.util.Arrays;
import java.util.Map;
+import javax.annotation.Resource;
+import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
@@ -18,12 +20,12 @@
import org.iri_research.renkan.repositories.UsersRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.HttpStatus;
+import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
@@ -41,11 +43,14 @@
private final Logger logger = LoggerFactory
.getLogger(UsersAdminController.class);
- @Autowired
+ @Inject
private UsersRepository usersRepository;
- @Autowired
+ @Inject
private ProjectsRepository projectsRepository;
+
+ @Resource(name="renkanPasswordEncoder")
+ private PasswordEncoder passwordEncoder;
@RequestMapping(value = "", method = RequestMethod.GET, produces = { "text/html;charset=UTF-8" })
public String usersList(
@@ -102,6 +107,7 @@
}
userForm.setUsersRepository(usersRepository);
+ userForm.setPasswordEncoder(passwordEncoder);
try {
userForm.save();
@@ -114,7 +120,7 @@
}
@RequestMapping(value = "/delete/{userId}")
- public String deleteSpace(HttpServletRequest request, Model model,
+ public String deleteUser(HttpServletRequest request, Model model,
@PathVariable(value = "userId") String userId,
@RequestParam(value = "key", required = false) String key,
@RequestParam(value = "salt", required = false) String salt)
--- a/server/src/main/java/org/iri_research/renkan/forms/SpaceForm.java Fri Oct 25 16:34:05 2013 +0200
+++ b/server/src/main/java/org/iri_research/renkan/forms/SpaceForm.java Mon Oct 28 18:20:56 2013 +0100
@@ -6,13 +6,9 @@
import org.iri_research.renkan.models.Space;
import org.iri_research.renkan.repositories.IRenkanRepository;
import org.iri_research.renkan.repositories.SpacesRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-@Component
public class SpaceForm extends RenkanForm<String, Space> {
- @Autowired
private SpacesRepository spacesRepository;
public SpaceForm() {
@@ -64,7 +60,6 @@
return new Space();
}
- @Autowired
public void setSpacesRepository(SpacesRepository spacesRepository) {
this.spacesRepository = spacesRepository;
}
--- a/server/src/main/java/org/iri_research/renkan/forms/UserForm.java Fri Oct 25 16:34:05 2013 +0200
+++ b/server/src/main/java/org/iri_research/renkan/forms/UserForm.java Mon Oct 28 18:20:56 2013 +0100
@@ -2,18 +2,13 @@
import java.util.Date;
-import javax.inject.Inject;
-import javax.inject.Named;
-
import org.iri_research.renkan.Constants;
import org.iri_research.renkan.models.User;
import org.iri_research.renkan.repositories.IRenkanRepository;
import org.iri_research.renkan.repositories.UsersRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.stereotype.Component;
-@Component
public class UserForm extends RenkanForm<String, User> {
private String avatar;
@@ -28,13 +23,14 @@
private String password;
private String passwordConfirm;
- @Inject
private UsersRepository usersRepository;
- @Inject
- @Named(value="renkanPasswordEncoder")
+
private PasswordEncoder passwordEncoder;
-
+
+ public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
+ this.passwordEncoder = passwordEncoder;
+ }
public UserForm() {
super();
--- a/server/src/main/webapp/WEB-INF/applicationContext.xml Fri Oct 25 16:34:05 2013 +0200
+++ b/server/src/main/webapp/WEB-INF/applicationContext.xml Mon Oct 28 18:20:56 2013 +0100
@@ -51,6 +51,9 @@
<!-- Configures the annotation-driven Spring MVC Controller programming model.
Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
+ <bean class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" id="renkanPasswordEncoder" name="renkanPasswordEncoder" scope="prototype">
+ <constructor-arg name="strength" value="10" type="int"/>
+ </bean>
<!-- Loads MongoDB configuraton -->
<import resource="mongo-config.xml"/>
@@ -68,7 +71,6 @@
For example @Controller and @Service. Make sure to set the correct base-package-->
<context:component-scan base-package="org.iri_research.renkan.rest" />
<context:component-scan base-package="org.iri_research.renkan.coweb" />
- <context:component-scan base-package="org.iri_research.renkan.forms" />
<context:component-scan base-package="org.iri_research.renkan.management" />
<!--mvc:annotation-driven>
--- a/server/src/main/webapp/WEB-INF/spring-security.xml Fri Oct 25 16:34:05 2013 +0200
+++ b/server/src/main/webapp/WEB-INF/spring-security.xml Mon Oct 28 18:20:56 2013 +0100
@@ -29,9 +29,6 @@
<property name="IgnoreResourceNotFound" value="true"/>
</bean>
- <bean class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" id="renkanPasswordEncoder">
- <constructor-arg name="strength" value="10" type="int"/>
- </bean>
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/admin" access="hasRole('ROLE_ADMIN')" />