File tree 11 files changed +26
-55
lines changed
springboot-thymeleaf-security-demo/src/main/java/net/alanbinu/springbootsecurity 11 files changed +26
-55
lines changed Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity ;
1
+ package net .alanbinu .springbootsecurity ;
2
2
3
3
import org .springframework .boot .SpringApplication ;
4
4
import org .springframework .boot .autoconfigure .SpringBootApplication ;
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .config ;
1
+ package net .alanbinu .springbootsecurity .config ;
2
2
3
3
import org .springframework .beans .factory .annotation .Autowired ;
4
4
import org .springframework .context .MessageSource ;
10
10
import org .springframework .web .servlet .config .annotation .WebMvcConfigurer ;
11
11
import org .thymeleaf .extras .springsecurity4 .dialect .SpringSecurityDialect ;
12
12
13
- /**
14
- * @author Ramesh Fadatare
15
- *
16
- */
13
+
17
14
@ Configuration
18
15
public class WebConfig implements WebMvcConfigurer
19
16
{
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .config ;
1
+ package net .alanbinu .springbootsecurity .config ;
2
2
3
3
import javax .sql .DataSource ;
4
4
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .entities ;
1
+ package net .alanbinu .springbootsecurity .entities ;
2
2
3
3
import javax .persistence .Column ;
4
4
import javax .persistence .Entity ;
7
7
import javax .persistence .Id ;
8
8
import javax .persistence .Table ;
9
9
10
- /**
11
- * @author Ramesh Fadatare
12
- *
13
- */
10
+
14
11
@ Entity
15
12
@ Table (name = "messages" )
16
13
public class Message {
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .entities ;
1
+ package net .alanbinu .springbootsecurity .entities ;
2
2
3
3
import java .util .List ;
4
4
12
12
13
13
import org .hibernate .validator .constraints .NotEmpty ;
14
14
15
- /**
16
- * @author Ramesh Fadatare
17
- *
18
- */
15
+
19
16
@ Entity
20
17
@ Table (name ="roles" )
21
18
public class Role
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .entities ;
1
+ package net .alanbinu .springbootsecurity .entities ;
2
2
3
3
import java .util .List ;
4
4
18
18
import org .hibernate .validator .constraints .Email ;
19
19
import org .hibernate .validator .constraints .NotEmpty ;
20
20
21
- /**
22
- * @author Ramesh Fadatare
23
- *
24
- */
25
21
@ Entity
26
22
@ Table (name ="users" )
27
23
public class User
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .repositories ;
1
+ package net .alanbinu .springbootsecurity .repositories ;
2
2
3
3
import org .springframework .data .jpa .repository .JpaRepository ;
4
4
5
- import net .javaguides .springbootsecurity .entities .Message ;
5
+ import net .alanbinu .springbootsecurity .entities .Message ;
6
+
6
7
7
- /**
8
- * @author Ramesh Fadatare
9
- *
10
- */
11
8
public interface MessageRepository extends JpaRepository <Message , Integer >{
12
9
13
10
}
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .repositories ;
1
+ package net .alanbinu .springbootsecurity .repositories ;
2
2
3
3
import java .util .Optional ;
4
4
5
5
import org .springframework .data .jpa .repository .JpaRepository ;
6
6
7
- import net .javaguides .springbootsecurity .entities .User ;
7
+ import net .alanbinu .springbootsecurity .entities .User ;
8
8
9
9
10
- /**
11
- * @author Ramesh Fadatare
12
- *
13
- */
14
10
public interface UserRepository extends JpaRepository <User , Integer >
15
11
{
16
12
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .security ;
1
+ package net .alanbinu .springbootsecurity .security ;
2
2
3
3
import java .util .Collection ;
4
4
import java .util .HashSet ;
8
8
import org .springframework .security .core .GrantedAuthority ;
9
9
import org .springframework .security .core .authority .AuthorityUtils ;
10
10
11
- import net .javaguides .springbootsecurity .entities .Role ;
12
- import net .javaguides .springbootsecurity .entities .User ;
11
+ import net .alanbinu .springbootsecurity .entities .Role ;
12
+ import net .alanbinu .springbootsecurity .entities .User ;
13
+
13
14
14
- /**
15
- * @author Ramesh Fadatare
16
- *
17
- */
18
15
public class AuthenticatedUser extends org .springframework .security .core .userdetails .User
19
16
{
20
17
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .security ;
1
+ package net .alanbinu .springbootsecurity .security ;
2
2
3
3
import java .util .Collection ;
4
4
11
11
import org .springframework .stereotype .Service ;
12
12
import org .springframework .transaction .annotation .Transactional ;
13
13
14
- import net .javaguides .springbootsecurity .entities .User ;
15
- import net .javaguides .springbootsecurity .repositories .UserRepository ;
14
+ import net .alanbinu .springbootsecurity .entities .User ;
15
+ import net .alanbinu .springbootsecurity .repositories .UserRepository ;
16
+
16
17
17
- /**
18
- * @author Ramesh Fadatare
19
- *
20
- */
21
18
@ Service
22
19
@ Transactional
23
20
public class CustomUserDetailsService implements UserDetailsService {
Original file line number Diff line number Diff line change 1
- package net .javaguides .springbootsecurity .web ;
1
+ package net .alanbinu .springbootsecurity .web ;
2
2
3
3
import org .springframework .beans .factory .annotation .Autowired ;
4
4
import org .springframework .stereotype .Controller ;
5
5
import org .springframework .ui .Model ;
6
6
import org .springframework .web .bind .annotation .GetMapping ;
7
7
import org .springframework .web .bind .annotation .PostMapping ;
8
8
9
- import net .javaguides .springbootsecurity .entities .Message ;
10
- import net .javaguides .springbootsecurity .repositories .MessageRepository ;
9
+ import net .alanbinu .springbootsecurity .entities .Message ;
10
+ import net .alanbinu .springbootsecurity .repositories .MessageRepository ;
11
+
11
12
12
- /**
13
- * @author Ramesh Fadatare
14
- *
15
- */
16
13
@ Controller
17
14
public class HomeController
18
15
{
You can’t perform that action at this time.
0 commit comments