-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
291 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.hotdog.Service; | ||
|
||
import com.hotdog.repositories.UserRepo; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.core.userdetails.UserDetailsService; | ||
import org.springframework.security.core.userdetails.UsernameNotFoundException; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class UserService implements UserDetailsService { | ||
|
||
private final UserRepo userRepo; | ||
|
||
public UserService(UserRepo userRepo) { | ||
this.userRepo = userRepo; | ||
} | ||
|
||
|
||
@Override | ||
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { | ||
return userRepo.findByUsername(s); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 2 additions & 26 deletions
28
src/main/java/com/hotdog/controllers/GreetingsController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,16 @@ | ||
package com.hotdog.controllers; | ||
import com.hotdog.entities.Info; | ||
import com.hotdog.repositories.InfoRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
import java.util.Map; | ||
|
||
@Controller | ||
public class GreetingsController { | ||
@Autowired | ||
private InfoRepository infoRepository; | ||
|
||
@GetMapping("/") | ||
public String greeting(Map<String, Object> model) { | ||
|
||
return "greeting"; | ||
} | ||
|
||
@GetMapping("/main") | ||
public String main(Map<String, Object> model) { | ||
Iterable<Info> info = infoRepository.findAll(); | ||
model.put("info", info); | ||
return "main"; | ||
} | ||
|
||
@PostMapping("/main") | ||
public String add(@RequestParam String name, @RequestParam String email, Map<String, Object> model) | ||
{ | ||
Info info = new Info(name, email); | ||
|
||
infoRepository.save(info); | ||
|
||
infoRepository.findAll(); | ||
model.put("info", info); | ||
return "main"; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
package com.hotdog.entities; | ||
|
||
public enum Role { | ||
import org.springframework.security.core.GrantedAuthority; | ||
|
||
public enum Role implements GrantedAuthority { | ||
USER; | ||
|
||
@Override | ||
public String getAuthority() { | ||
return name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.