Class ServletManager
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.web.context.ServletContextAware
Enables the use of programmatically adding servlets to the given ServletContext.
Run during the ApplicationServers contextInitialized phase, before starting servlets.
This ensures that all (dynamic) servlets are created, before servlets are being created.
This in turn avoids a ConcurrentModificationException if this where to be done during a servlet initialization phase.
When dtap.stage is set to LOC, the default behavior of each servlet is not-secured (no authentication) on HTTP.
When dtap.stage is NOT set to LOC, the default behavior of each servlet is secured (authentication enforced) on HTTPS.
To change this behavior the following properties can be used;
servlet.servlet-name.transportGuarantee - forces HTTPS when set to CONFIDENTIAL, or HTTP when set to NONE
servlet.servlet-name.securityRoles - use the default IBIS roles or create your own
servlet.servlet-name.urlMapping - path the servlet listens to
servlet.servlet-name.loadOnStartup - automatically load or use lazy-loading (affects application startup time)
servlet.servlet-name.authenticator - enables authentication on this endpoint
- Author:
- Niels Meijer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddeclareRoles(List<String> roleNames) Register a new rolegetServlet(String name) protected jakarta.servlet.ServletContextstatic jakarta.servlet.annotation.ServletSecurity.TransportGuaranteegetTransportGuarantee(String propertyName) voidregister(ServletConfiguration config) voidsetServletContext(jakarta.servlet.ServletContext servletContext) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
-
Constructor Details
-
ServletManager
public ServletManager()
-
-
Method Details
-
getServletContext
protected jakarta.servlet.ServletContext getServletContext() -
getDeclaredRoles
-
setServletContext
@Autowired @Lazy public void setServletContext(jakarta.servlet.ServletContext servletContext) - Specified by:
setServletContextin interfaceorg.springframework.web.context.ServletContextAware
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
startAuthenticators
public void startAuthenticators() -
declareRoles
Register a new role- Parameters:
roleNames- String or multiple strings of roleNames to register
-
register
-
getServlet
-
getServlets
-
getTransportGuarantee
public static jakarta.servlet.annotation.ServletSecurity.TransportGuarantee getTransportGuarantee(String propertyName)
-