Commit 6cd521ac authored by Mamadou Diallo's avatar Mamadou Diallo
Browse files

App connected to a database + few updates

parent b0881124
......@@ -24,6 +24,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
/*
users.stream().map(user -> {
try {
auth.inMemoryAuthentication().withUser(user.getUserName())
......@@ -34,6 +35,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
}
return null;
});
*/
}
@Override
......@@ -41,9 +43,9 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/api/admin/**").hasRole(Const.ADMIN)
.antMatchers(HOME).hasAnyRole(Const.USER, Const.ADMIN)
.antMatchers("/api/login*").permitAll()
//.antMatchers("/api/admin/**").hasRole(Const.ADMIN)
//.antMatchers("/api/home").permitAll()
//.antMatchers("/api/login*").permitAll()
.anyRequest().authenticated();
}
}
......@@ -45,6 +45,7 @@ public class CommentController {
repository.deleteById(id);
}
@GetMapping("/all")
public List<Comment> getAll() {
return repository.findAll();
}
......
......@@ -45,6 +45,7 @@ public class PostController {
repository.deleteById(id);
}
@GetMapping("/all")
public List<Post> getAll() {
return repository.findAll();
}
......
......@@ -45,6 +45,7 @@ public class UserController {
repository.deleteById(id);
}
@GetMapping("/all")
public List<User> getAll() {
return repository.findAll();
}
......
server.potr = 8000
server.port = 8000
#spring.data.mongodb.uri=mongodb+srv://mdiallo:mdiallo@cluster0.eagd9.mongodb.net/myFirstDatabase?retryWrites=true&w=majority
#spring.data.mongodb.database=middleware
spring.data.mongodb.uri=mongodb://localhost:27017/middleware
spring.datasource.username=mdiallo
spring.datasource.password=mdiallo
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment