Skip to content

Commit

Permalink
✨ ignore api/v1/auth in the JwtAuthenticationFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-bouali committed Apr 6, 2023
1 parent 3256565 commit dfee1e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.beans.Transient;
import java.io.IOException;
import java.security.Security;

import jakarta.transaction.TransactionScoped;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.lang.NonNull;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
Expand All @@ -31,6 +36,10 @@ protected void doFilterInternal(
@NonNull HttpServletResponse response,
@NonNull FilterChain filterChain
) throws ServletException, IOException {
if (request.getServletPath().contains("/api/v1/auth")) {
filterChain.doFilter(request, response);
return;
}
final String authHeader = request.getHeader("Authorization");
final String jwt;
final String userEmail;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/alibou/security/token/Token.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Token {

public boolean expired;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
public User user;
}

0 comments on commit dfee1e5

Please sign in to comment.