net.smartcosmos.security.authentication.direct.DirectUnauthorizedEntryPoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smartcosmos-framework Show documentation
Show all versions of smartcosmos-framework Show documentation
Provides Spring Configuration and Annotations making it easier to develop SMART COSMOS Extensions
The newest version!
package net.smartcosmos.security.authentication.direct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Returns a 401 error code (Unauthorized) to the client.
*/
@Slf4j
public class DirectUnauthorizedEntryPoint extends LoginUrlAuthenticationEntryPoint {
public DirectUnauthorizedEntryPoint(String loginFormUrl) {
super(loginFormUrl);
}
/**
* Always returns a 401 error code to the client.
*/
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
log.debug("Pre-authenticated entry point called. Rejecting access");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Access Denied");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy