Files
scavengerhunt-api/src/main/kotlin/net/halfbinary/scavengerhuntapi/config/AuthEntrypointJwt.kt

18 lines
637 B
Kotlin

package net.halfbinary.scavengerhuntapi.config
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.springframework.security.core.AuthenticationException
import org.springframework.security.web.AuthenticationEntryPoint
import org.springframework.stereotype.Component
@Component
class AuthEntrypointJwt: AuthenticationEntryPoint {
override fun commence(
request: HttpServletRequest,
response: HttpServletResponse,
authException: AuthenticationException
) {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.message)
}
}