Package net.ltgt.oidc.servlet
Class UserFilter
java.lang.Object
jakarta.servlet.GenericFilter
jakarta.servlet.http.HttpFilter
net.ltgt.oidc.servlet.UserFilter
- All Implemented Interfaces:
Filter,FilterConfig,Serializable
Checks whether the user is authenticated.
Initializes the request's getUserPrincipal() and
getRemoteUser(), and implements its isUserInRole(String) for other filters and servlets down the
chain. The user principal will be created by a UserPrincipalFactory present in the ServletContext.
Invalidates the HttpSession if a LoggedOutSessionStore is present in the ServletContext and the session has been recorded
as logged out on the OpenID Provider through the OpenID Connect Back-Channel Logout protocol.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUserFilter(UserPrincipalFactory userPrincipalFactory) Constructs a filter with the givenUserPrincipalfactory and no logged-out session store.UserFilter(UserPrincipalFactory userPrincipalFactory, @Nullable LoggedOutSessionStore loggedOutSessionStore) Constructs a filter with the givenUserPrincipalfactory and (optional) logged-out session store. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) voidinit()Methods inherited from class jakarta.servlet.http.HttpFilter
doFilterMethods inherited from class jakarta.servlet.GenericFilter
getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init
-
Constructor Details
-
UserFilter
public UserFilter() -
UserFilter
Constructs a filter with the givenUserPrincipalfactory and no logged-out session store.When this constructor is used, the servlet context attributes won't be read.
This is equivalent to
new UserFilter(userPrincipalFactory, null). -
UserFilter
public UserFilter(UserPrincipalFactory userPrincipalFactory, @Nullable LoggedOutSessionStore loggedOutSessionStore) Constructs a filter with the givenUserPrincipalfactory and (optional) logged-out session store.When this constructor is used, the servlet context attributes won't be read.
-
-
Method Details
-
init
- Overrides:
initin classGenericFilter- Throws:
ServletException
-
doFilter
protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException - Overrides:
doFilterin classHttpFilter- Throws:
IOExceptionServletException
-