Skip to content

Commit f743cd1

Browse files
committed
work
1 parent 6cf1b82 commit f743cd1

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

src/main/java/org/woehlke/simpleworklist/config/WebMvcConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
@EnableConfigurationProperties({
3636
SimpleworklistProperties.class
3737
})
38-
public class WebMvcConfig extends WebMvcConfigurerAdapter implements WebMvcConfigurer {
38+
public class WebMvcConfig implements WebMvcConfigurer {
3939

4040
private final SimpleworklistProperties simpleworklistProperties;
4141

src/main/java/org/woehlke/simpleworklist/config/WebSecurityConfig.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
import org.springframework.scheduling.annotation.EnableAsync;
1111
import org.springframework.security.authentication.AuthenticationManager;
1212
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
13+
import org.springframework.security.config.annotation.web.WebSecurityConfigurer;
1314
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
15+
import org.springframework.security.config.annotation.web.builders.WebSecurity;
1416
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
1517
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
1618
import org.springframework.security.core.userdetails.UserDetailsService;
1719
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
1820
import org.springframework.security.crypto.password.PasswordEncoder;
19-
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder;
2021
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
2122
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
2223
import org.woehlke.simpleworklist.application.SimpleworklistProperties;
@@ -35,7 +36,7 @@
3536
@EnableConfigurationProperties({
3637
SimpleworklistProperties.class
3738
})
38-
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
39+
public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements WebSecurityConfigurer<WebSecurity> {
3940

4041
private final AuthenticationManagerBuilder authenticationManagerBuilder;
4142
//private final AuthenticationSuccessHandler loginSuccessHandler;
@@ -54,6 +55,16 @@ public WebSecurityConfig(
5455
this.simpleworklistProperties = simpleworklistProperties;
5556
}
5657

58+
/*
59+
@Override
60+
public void init(WebSecurity builder) throws Exception {
61+
62+
}
63+
@Override
64+
public void configure(WebSecurity builder) throws Exception {
65+
}
66+
*/
67+
5768
@Override
5869
protected void configure(HttpSecurity http) throws Exception {
5970
http
@@ -99,7 +110,7 @@ public UserDetailsService userDetailsService(){
99110
public PasswordEncoder encoder(){
100111
int strength = simpleworklistProperties.getWebSecurity().getStrengthBCryptPasswordEncoder();
101112
return new BCryptPasswordEncoder(strength);
102-
/*Ü
113+
/*
103114
CharSequence secret=this.simpleworklistProperties.getWebSecurity().getSecret();
104115
int iterations=this.simpleworklistProperties.getWebSecurity().getIterations();
105116
int hashWidth=this.simpleworklistProperties.getWebSecurity().getHashWidth();

src/main/java/org/woehlke/simpleworklist/user/services/UserAccountService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public interface UserAccountService {
2121

2222
void changeUsersPassword(UserAccountForm userAccount);
2323

24-
UserAccount findUserById(long userId);
24+
UserAccount findById(long userId);
2525

2626
Map<Long,Integer> getNewIncomingMessagesForEachOtherUser(UserAccount receiver);
2727

src/main/java/org/woehlke/simpleworklist/user/services/UserAccountServiceImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public boolean isEmailAvailable(String email) {
4747

4848
@Override
4949
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
50-
public void createUser(UserAccountForm userAccount) {
50+
public void createUser(UserAccountForm userAccountForm) {
51+
Date now = new Date();
5152
UserAccount u = new UserAccount();
5253
u.setUuid(UUID.randomUUID().toString());
53-
u.setUserEmail(userAccount.getUserEmail());
54-
u.setUserFullname(userAccount.getUserFullname());
55-
u.setUserPassword(encoder.encode(userAccount.getUserPassword()));
54+
u.setUserEmail(userAccountForm.getUserEmail());
55+
u.setUserFullname(userAccountForm.getUserFullname());
56+
u.setUserPassword(encoder.encode(userAccountForm.getUserPassword()));
5657
u.setDefaultLanguage(Language.EN);
57-
Date now = new Date();
5858
u.setLastLoginTimestamp(now);
5959
u.setAccountNonExpired(true);
6060
u.setAccountNonLocked(true);
@@ -68,13 +68,13 @@ public void createUser(UserAccountForm userAccount) {
6868
privContext.setUuid(UUID.randomUUID().toString());
6969
workContext.setUserAccount(u);
7070
privContext.setUserAccount(u);
71-
log.info("About to save " + workContext.toString());
7271
contextRepository.save(workContext);
73-
log.info("About to save " + privContext.toString());
7472
contextRepository.save(privContext);
7573
u.setDefaultContext(workContext);
7674
u = userAccountRepository.save(u);
7775
log.info("Saved " + u.toString());
76+
log.info("Saved " + workContext.toString());
77+
log.info("Saved " + privContext.toString());
7878
}
7979

8080
@Override
@@ -105,8 +105,8 @@ public void changeUsersPassword(UserAccountForm userAccount) {
105105
}
106106

107107
@Override
108-
public UserAccount findUserById(long userId) {
109-
return userAccountRepository.getOne(userId);
108+
public UserAccount findById(long userId) {
109+
return userAccountRepository.getReferenceById(userId);
110110
}
111111

112112
@Override

0 commit comments

Comments
 (0)