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

cn.home1.oss.lib.security.internal.rest.RestfulAuthenticationEntryPoint Maven / Gradle / Ivy

There is a newer version: 1.0.8.OSS
Show newest version
package cn.home1.oss.lib.security.internal.rest;

import cn.home1.oss.lib.errorhandle.internal.RestfulExceptionHandler;

import lombok.NonNull;
import lombok.Setter;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import java.io.IOException;

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

/**
 * 认证失败不清cookie.
 *
 * 

Created by zhanghaolun on 16/6/28.

*/ public class RestfulAuthenticationEntryPoint implements AuthenticationEntryPoint { @NonNull @Setter private RestfulExceptionHandler exceptionHandler; public static RestfulAuthenticationEntryPoint restfulEntryPoint(final RestfulExceptionHandler exceptionHandler) { final RestfulAuthenticationEntryPoint entryPoint = new RestfulAuthenticationEntryPoint(); entryPoint.setExceptionHandler(exceptionHandler); return entryPoint; } @Override public void commence( // final HttpServletRequest request, // final HttpServletResponse response, // final AuthenticationException authException // ) throws IOException, ServletException { //response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); this.exceptionHandler.resolveAndHandle(request, response, authException); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy