mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-26 22:02:41 +00:00
Restore Removed Throws Clauses
In a recent clean-up, certain exceptions were removed from various throws clauses. This PR re-introduces throws clauses that are important for one of the following reasons: 1. It's a method on a public interface 2. It's a method clearly designed for inheritance, for example, a method stub, an abstract method, or indicated as such in the docs. Fixes gh-7541
This commit is contained in:
parent
a4430aa21b
commit
5f17032ffd
@ -343,7 +343,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|||||||
* method. Subclasses may override this method to hook into the lifecycle without
|
* method. Subclasses may override this method to hook into the lifecycle without
|
||||||
* using a {@link SecurityConfigurer}.
|
* using a {@link SecurityConfigurer}.
|
||||||
*/
|
*/
|
||||||
protected void beforeInit() {
|
protected void beforeInit() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,7 +228,7 @@ public class AuthenticationManagerBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ProviderManager performBuild() {
|
protected ProviderManager performBuild() throws Exception {
|
||||||
if (!isConfigured()) {
|
if (!isConfigured()) {
|
||||||
logger.debug("No authenticationProviders and no parentAuthenticationManager defined. Returning null.");
|
logger.debug("No authenticationProviders and no parentAuthenticationManager defined. Returning null.");
|
||||||
return null;
|
return null;
|
||||||
|
@ -331,7 +331,7 @@ public abstract class WebSecurityConfigurerAdapter implements
|
|||||||
* Override this method to configure {@link WebSecurity}. For example, if you wish to
|
* Override this method to configure {@link WebSecurity}. For example, if you wish to
|
||||||
* ignore certain requests.
|
* ignore certain requests.
|
||||||
*/
|
*/
|
||||||
public void configure(WebSecurity web) {
|
public void configure(WebSecurity web) throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,7 +228,7 @@ public abstract class AbstractUserDetailsAuthenticationProvider implements
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAfterPropertiesSet() {
|
protected void doAfterPropertiesSet() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserCache getUserCache() {
|
public UserCache getUserCache() {
|
||||||
|
@ -16,9 +16,11 @@
|
|||||||
|
|
||||||
package org.springframework.security.authentication.jaas;
|
package org.springframework.security.authentication.jaas;
|
||||||
|
|
||||||
import org.springframework.security.core.Authentication;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.security.auth.callback.Callback;
|
import javax.security.auth.callback.Callback;
|
||||||
|
import javax.security.auth.callback.UnsupportedCallbackException;
|
||||||
|
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The JaasAuthenticationCallbackHandler is similar to the
|
* The JaasAuthenticationCallbackHandler is similar to the
|
||||||
@ -58,5 +60,6 @@ public interface JaasAuthenticationCallbackHandler {
|
|||||||
* @param auth The Authentication object currently being authenticated.
|
* @param auth The Authentication object currently being authenticated.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void handle(Callback callback, Authentication auth);
|
void handle(Callback callback, Authentication auth) throws IOException,
|
||||||
|
UnsupportedCallbackException;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,8 @@ public class AuthenticationSimpleHttpInvokerRequestExecutor extends
|
|||||||
* @param contentLength the length of the content to send
|
* @param contentLength the length of the content to send
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void doPrepareConnection(HttpURLConnection con, int contentLength) {
|
protected void doPrepareConnection(HttpURLConnection con, int contentLength)
|
||||||
|
throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package org.springframework.security.web.access.channel;
|
package org.springframework.security.web.access.channel;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@ -47,5 +47,5 @@ public interface ChannelEntryPoint {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void commence(HttpServletRequest request, HttpServletResponse response)
|
void commence(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws IOException;
|
throws IOException, ServletException;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,8 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
|
|||||||
* @throws AuthenticationException if authentication fails.
|
* @throws AuthenticationException if authentication fails.
|
||||||
*/
|
*/
|
||||||
public abstract Authentication attemptAuthentication(HttpServletRequest request,
|
public abstract Authentication attemptAuthentication(HttpServletRequest request,
|
||||||
HttpServletResponse response) throws AuthenticationException, IOException;
|
HttpServletResponse response) throws AuthenticationException, IOException,
|
||||||
|
ServletException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default behaviour for successful authentication.
|
* Default behaviour for successful authentication.
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
package org.springframework.security.web.authentication;
|
package org.springframework.security.web.authentication;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.web.DefaultRedirectStrategy;
|
import org.springframework.security.web.DefaultRedirectStrategy;
|
||||||
import org.springframework.security.web.RedirectStrategy;
|
import org.springframework.security.web.RedirectStrategy;
|
||||||
@ -78,7 +79,7 @@ public abstract class AbstractAuthenticationTargetUrlRequestHandler {
|
|||||||
* The redirect will not be performed if the response has already been committed.
|
* The redirect will not be performed if the response has already been committed.
|
||||||
*/
|
*/
|
||||||
protected void handle(HttpServletRequest request, HttpServletResponse response,
|
protected void handle(HttpServletRequest request, HttpServletResponse response,
|
||||||
Authentication authentication) throws IOException {
|
Authentication authentication) throws IOException, ServletException {
|
||||||
String targetUrl = determineTargetUrl(request, response, authentication);
|
String targetUrl = determineTargetUrl(request, response, authentication);
|
||||||
|
|
||||||
if (response.isCommitted()) {
|
if (response.isCommitted()) {
|
||||||
|
@ -211,7 +211,8 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
|
|||||||
* Builds a URL to redirect the supplied request to HTTPS. Used to redirect the
|
* Builds a URL to redirect the supplied request to HTTPS. Used to redirect the
|
||||||
* current request to HTTPS, before doing a forward to the login page.
|
* current request to HTTPS, before doing a forward to the login page.
|
||||||
*/
|
*/
|
||||||
protected String buildHttpsRedirectUrlForRequest(HttpServletRequest request) {
|
protected String buildHttpsRedirectUrlForRequest(HttpServletRequest request)
|
||||||
|
throws IOException, ServletException {
|
||||||
|
|
||||||
int serverPort = portResolver.getServerPort(request);
|
int serverPort = portResolver.getServerPort(request);
|
||||||
Integer httpsPort = portMapper.lookupHttpsPort(serverPort);
|
Integer httpsPort = portMapper.lookupHttpsPort(serverPort);
|
||||||
|
@ -244,11 +244,11 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onSuccessfulAuthentication(HttpServletRequest request,
|
protected void onSuccessfulAuthentication(HttpServletRequest request,
|
||||||
HttpServletResponse response, Authentication authResult) {
|
HttpServletResponse response, Authentication authResult) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onUnsuccessfulAuthentication(HttpServletRequest request,
|
protected void onUnsuccessfulAuthentication(HttpServletRequest request,
|
||||||
HttpServletResponse response, AuthenticationException failed) {
|
HttpServletResponse response, AuthenticationException failed) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AuthenticationEntryPoint getAuthenticationEntryPoint() {
|
protected AuthenticationEntryPoint getAuthenticationEntryPoint() {
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.security.web.session;
|
package org.springframework.security.web.session;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the behaviour of the {@code SessionManagementFilter} when an invalid session
|
* Determines the behaviour of the {@code SessionManagementFilter} when an invalid session
|
||||||
@ -28,6 +29,6 @@ import java.io.IOException;
|
|||||||
public interface InvalidSessionStrategy {
|
public interface InvalidSessionStrategy {
|
||||||
|
|
||||||
void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response)
|
void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws IOException;
|
throws IOException, ServletException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package org.springframework.security.web.session;
|
package org.springframework.security.web.session;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the behaviour of the {@code ConcurrentSessionFilter} when an expired session
|
* Determines the behaviour of the {@code ConcurrentSessionFilter} when an expired session
|
||||||
@ -28,5 +29,5 @@ import java.io.IOException;
|
|||||||
public interface SessionInformationExpiredStrategy {
|
public interface SessionInformationExpiredStrategy {
|
||||||
|
|
||||||
void onExpiredSessionDetected(SessionInformationExpiredEvent event)
|
void onExpiredSessionDetected(SessionInformationExpiredEvent event)
|
||||||
throws IOException;
|
throws IOException, ServletException;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user