spring security CsrfTokenRepository 源码
spring security CsrfTokenRepository 代码
文件路径:/web/src/main/java/org/springframework/security/web/csrf/CsrfTokenRepository.java
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.security.web.csrf;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
/**
* An API to allow changing the method in which the expected {@link CsrfToken} is
* associated to the {@link HttpServletRequest}. For example, it may be stored in
* {@link HttpSession}.
*
* @author Rob Winch
* @since 3.2
* @see HttpSessionCsrfTokenRepository
*/
public interface CsrfTokenRepository {
/**
* Generates a {@link CsrfToken}
* @param request the {@link HttpServletRequest} to use
* @return the {@link CsrfToken} that was generated. Cannot be null.
*/
CsrfToken generateToken(HttpServletRequest request);
/**
* Saves the {@link CsrfToken} using the {@link HttpServletRequest} and
* {@link HttpServletResponse}. If the {@link CsrfToken} is null, it is the same as
* deleting it.
* @param token the {@link CsrfToken} to save or null to delete
* @param request the {@link HttpServletRequest} to use
* @param response the {@link HttpServletResponse} to use
*/
void saveToken(CsrfToken token, HttpServletRequest request, HttpServletResponse response);
/**
* Loads the expected {@link CsrfToken} from the {@link HttpServletRequest}
* @param request the {@link HttpServletRequest} to use
* @return the {@link CsrfToken} or null if none exists
*/
CsrfToken loadToken(HttpServletRequest request);
}
相关信息
相关文章
spring security CookieCsrfTokenRepository 源码
spring security CsrfAuthenticationStrategy 源码
spring security CsrfException 源码
spring security CsrfLogoutHandler 源码
spring security DefaultCsrfToken 源码
spring security HttpSessionCsrfTokenRepository 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
7、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦