Skip to content

Commit c23f1fa

Browse files
rahulrahul
authored andcommitted
first commit
1 parent c1e3568 commit c23f1fa

File tree

8 files changed

+4
-22
lines changed

8 files changed

+4
-22
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>io.jsonwebtoken</groupId>
4545
<artifactId>jjwt</artifactId>
46-
<version>0.2</version>
46+
<version>0.9.0</version>
4747
</dependency>
4848

4949
</dependencies>

src/main/java/com/baghaniya/springsecurity/config/SecurityConfig.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@ protected void configure(HttpSecurity http) throws Exception {
8484
"/**/*.css",
8585
"/**/*.js")
8686
.permitAll()
87-
.antMatchers("/api/auth/**")
88-
.permitAll()
89-
.antMatchers("/api/user/checkUsernameAvailability", "/api/user/checkEmailAvailability")
90-
.permitAll()
91-
.antMatchers(HttpMethod.GET, "/api/polls/**", "/api/users/**")
87+
.antMatchers("/auth/**")
9288
.permitAll()
9389
.antMatchers("/h2/**")
9490
.permitAll()

src/main/java/com/baghaniya/springsecurity/controller/AuthController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Created by RAHUL on Jul, 2018
3434
*/
3535
@RestController
36-
@RequestMapping("/api/auth")
36+
@RequestMapping("/auth")
3737
public class AuthController {
3838

3939
@Autowired

src/main/java/com/baghaniya/springsecurity/model/Role.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class Role {
1616

1717
@Enumerated(EnumType.STRING)
1818
@NaturalId
19-
@Column(length = 60)
2019
private RoleName name;
2120

2221
public Role() {

src/main/java/com/baghaniya/springsecurity/model/User.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,17 @@ public class User {
2828
private Long id;
2929

3030
@NotBlank
31-
@Size(max = 40)
3231
private String name;
3332

3433
@NotBlank
35-
@Size(max = 15)
3634
private String username;
3735

3836
@NaturalId
3937
@NotBlank
40-
@Size(max = 40)
4138
@Email
4239
private String email;
4340

4441
@NotBlank
45-
@Size(max = 100)
4642
private String password;
4743

4844
@ManyToMany(fetch = FetchType.LAZY)

src/main/java/com/baghaniya/springsecurity/payload/SignUpRequest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@
1010

1111
public class SignUpRequest {
1212
@NotBlank
13-
@Size(min = 4, max = 40)
1413
private String name;
1514

1615
@NotBlank
17-
@Size(min = 3, max = 15)
1816
private String username;
1917

2018
@NotBlank
21-
@Size(max = 40)
2219
@Email
2320
private String email;
2421

2522
@NotBlank
26-
@Size(min = 6, max = 20)
2723
private String password;
2824

2925
public String getName() {

src/main/java/com/baghaniya/springsecurity/security/JwtAuthenticationFilter.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
3737
if (StringUtils.hasText(jwt) && tokenProvider.validateToken(jwt)) {
3838
Long userId = tokenProvider.getUserIdFromJWT(jwt);
3939

40-
/*
41-
Note that you could also encode the user's username and roles inside JWT claims
42-
and create the UserDetails object by parsing those claims from the JWT.
43-
That would avoid the following database hit. It's completely up to you.
44-
*/
4540
UserDetails userDetails = userDetailsService.loadUserById(userId);
4641
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
4742
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ logging.level.org.hibernate.SQL= DEBUG
1919

2020

2121
## App Properties
22-
app.jwtSecret= JWTSuperSecretKey
22+
app.jwtSecret= JwtSecretKey
2323
app.jwtExpirationInMs = 604800000
2424

2525
## Spring Profiles

0 commit comments

Comments
 (0)