Package org.dspace.app.rest.security
Class ShibbolethAuthenticationFilter
- java.lang.Object
-
- org.springframework.web.filter.GenericFilterBean
-
- org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
-
- org.dspace.app.rest.security.StatelessLoginFilter
-
- org.dspace.app.rest.security.ShibbolethAuthenticationFilter
-
- All Implemented Interfaces:
javax.servlet.Filter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.EnvironmentAware,org.springframework.context.MessageSourceAware,org.springframework.core.env.EnvironmentCapable,org.springframework.web.context.ServletContextAware
public class ShibbolethAuthenticationFilter extends StatelessLoginFilter
This class will filter Shibboleth requests to see if the user has been authenticated via Shibboleth.This filter runs before the ShibbolethRestController, in order to verify Shibboleth authentication succeeded, and create the authentication token (JWT).
- Author:
- Giuseppe Digilio (giuseppe dot digilio at 4science dot it)
- See Also:
ShibbolethRestController,ShibAuthentication
-
-
Field Summary
-
Fields inherited from class org.dspace.app.rest.security.StatelessLoginFilter
authenticationManager, restAuthenticationService
-
-
Constructor Summary
Constructors Constructor Description ShibbolethAuthenticationFilter(String url, org.springframework.security.authentication.AuthenticationManager authenticationManager, RestAuthenticationService restAuthenticationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.core.AuthenticationattemptAuthentication(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Attempt to authenticate the user by using Spring Security's AuthenticationManager.protected voidsuccessfulAuthentication(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.FilterChain chain, org.springframework.security.core.Authentication auth)If the above attemptAuthentication() call was successful (no authentication error was thrown), then this method will take the returnedDSpaceAuthenticationclass (which includes all the data from the authenticated user) and add the authentication data to the response.-
Methods inherited from class org.dspace.app.rest.security.StatelessLoginFilter
afterPropertiesSet, unsuccessfulAuthentication
-
Methods inherited from class org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
doFilter, getAllowSessionCreation, getAuthenticationManager, getFailureHandler, getRememberMeServices, getSuccessHandler, requiresAuthentication, setAllowSessionCreation, setApplicationEventPublisher, setAuthenticationDetailsSource, setAuthenticationFailureHandler, setAuthenticationManager, setAuthenticationSuccessHandler, setContinueChainBeforeSuccessfulAuthentication, setFilterProcessesUrl, setMessageSource, setRememberMeServices, setRequiresAuthenticationRequestMatcher, setSessionAuthenticationStrategy
-
-
-
-
Constructor Detail
-
ShibbolethAuthenticationFilter
public ShibbolethAuthenticationFilter(String url, org.springframework.security.authentication.AuthenticationManager authenticationManager, RestAuthenticationService restAuthenticationService)
-
-
Method Detail
-
attemptAuthentication
public org.springframework.security.core.Authentication attemptAuthentication(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws org.springframework.security.core.AuthenticationExceptionDescription copied from class:StatelessLoginFilterAttempt to authenticate the user by using Spring Security's AuthenticationManager. The AuthenticationManager will delegate this task to one or more AuthenticationProvider classes.For DSpace, our custom AuthenticationProvider is
EPersonRestAuthenticationProvider, so that is the authenticate() method which is called below.- Overrides:
attemptAuthenticationin classStatelessLoginFilter- Parameters:
req- current requestres- current response- Returns:
- a valid Spring Security Authentication object if authentication succeeds
- Throws:
org.springframework.security.core.AuthenticationException- if authentication fails- See Also:
EPersonRestAuthenticationProvider
-
successfulAuthentication
protected void successfulAuthentication(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.FilterChain chain, org.springframework.security.core.Authentication auth) throws IOException, javax.servlet.ServletExceptionDescription copied from class:StatelessLoginFilterIf the above attemptAuthentication() call was successful (no authentication error was thrown), then this method will take the returnedDSpaceAuthenticationclass (which includes all the data from the authenticated user) and add the authentication data to the response.For DSpace, this is calling our
JWTTokenRestAuthenticationServiceImplin order to create a JWT based on the authentication data & send that JWT back in the response.- Overrides:
successfulAuthenticationin classStatelessLoginFilter- Parameters:
req- current requestres- responsechain- FilterChainauth- Authentication object containing info about user who had a successful authentication- Throws:
IOExceptionjavax.servlet.ServletException- See Also:
JWTTokenRestAuthenticationServiceImpl
-
-