All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.leopard.web4j.nobug.csrf.CsrfCheckerNoCsrfImpl Maven / Gradle / Ivy

There is a newer version: 0.9.12
Show newest version
package io.leopard.web4j.nobug.csrf;

import io.leopard.web4j.nobug.csrf.annotation.Csrf;

import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.method.HandlerMethod;

public class CsrfCheckerNoCsrfImpl implements CsrfChecker {

	@Override
	public boolean isSafe(HandlerMethod handlerMethod, HttpServletRequest request, HttpServletResponse response, TokenVerifier tokenVerifier) {
		Method method = handlerMethod.getMethod();
		Csrf csrf = method.getAnnotation(Csrf.class);
		if (csrf == null) {
			return true;
		}
		if (csrf.enable()) {
			return false;
		}
		return true;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy