| | |
| | | |
| | | @Component |
| | | public class AdminAuthInterceptor implements HandlerInterceptor { |
| | | public static final String OPERATOR_ID_ATTRIBUTE = "authenticatedAdminOperatorId"; |
| | | |
| | | private final AdminAuthService service; |
| | | |
| | | public AdminAuthInterceptor(AdminAuthService service) { |
| | |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
| | | service.authenticate(request.getHeader(HttpHeaders.AUTHORIZATION)); |
| | | Long operatorId = service.authenticate(request.getHeader(HttpHeaders.AUTHORIZATION)); |
| | | request.setAttribute(OPERATOR_ID_ATTRIBUTE, operatorId); |
| | | return true; |
| | | } |
| | | } |