Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAIN-T-95 Do not access token for anonymous requests #78

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ import java.io.IOException
@Component
class JwtAuthorizationFilter(private val userService: UserService) : OncePerRequestFilter() {
private val authorizationHeader = "Authorization"
private val anonymousEndpoints = arrayOf("/register", "/login")

@Throws(ServletException::class, IOException::class)
override fun doFilterInternal(request: HttpServletRequest, response: HttpServletResponse, filterChain: FilterChain) {
LOG.debug("Jwt Authorization Filter is invoked.")

if (anonymousEndpoints.contains(request.requestURI)) {
LOG.debug("No check token for request ${request.requestURI}")
filterChain.doFilter(request, response)
return
}

try {
val token = getTokenFromRequest(request)
if (token != null) {
Expand Down