public abstract class ShiroWebModule extends ShiroModule
WebSecurityManager
, SecurityManager
and SessionManager
. At least one realm must be added by
using bindRealm
.
Also provides for the configuring of filter chains and binds a FilterChainResolver
with that information.Modifier and Type | Class and Description |
---|---|
static class |
ShiroWebModule.FilterConfig<T extends javax.servlet.Filter>
Filter configuration which pairs a Filter class with its configuration used on a path.
|
Modifier and Type | Field and Description |
---|---|
static com.google.inject.Key<AnonymousFilter> |
ANON |
static com.google.inject.Key<FormAuthenticationFilter> |
AUTHC |
static com.google.inject.Key<BasicHttpAuthenticationFilter> |
AUTHC_BASIC |
static com.google.inject.Key<LogoutFilter> |
LOGOUT |
static com.google.inject.Key<NoSessionCreationFilter> |
NO_SESSION_CREATION |
static com.google.inject.Key<PermissionsAuthorizationFilter> |
PERMS |
static com.google.inject.Key<PortFilter> |
PORT |
static com.google.inject.Key<HttpMethodPermissionFilter> |
REST |
static com.google.inject.Key<RolesAuthorizationFilter> |
ROLES |
static com.google.inject.Key<SslFilter> |
SSL |
static com.google.inject.Key<UserFilter> |
USER |
Constructor and Description |
---|
ShiroWebModule(javax.servlet.ServletContext servletContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
addFilterChain(String pattern,
com.google.inject.Key<? extends javax.servlet.Filter>... keys)
Deprecated.
|
protected void |
addFilterChain(String pattern,
com.google.inject.Key<? extends javax.servlet.Filter> key) |
protected void |
addFilterChain(String pattern,
ShiroWebModule.FilterConfig<? extends javax.servlet.Filter>... filterConfigs)
Maps 'n' number of
filterConfig s to a specific path pattern. |
protected void |
bindEnvironment(com.google.inject.binder.AnnotatedBindingBuilder<Environment> bind)
Binds the environment.
|
static void |
bindGuiceFilter(com.google.inject.Binder binder) |
static void |
bindGuiceFilter(String pattern,
com.google.inject.Binder binder) |
protected void |
bindSecurityManager(com.google.inject.binder.AnnotatedBindingBuilder<? super SecurityManager> bind)
Binds the security manager.
|
protected void |
bindSessionManager(com.google.inject.binder.AnnotatedBindingBuilder<SessionManager> bind)
Binds the session manager.
|
protected void |
bindWebEnvironment(com.google.inject.binder.AnnotatedBindingBuilder<? super WebEnvironment> bind) |
protected void |
bindWebSecurityManager(com.google.inject.binder.AnnotatedBindingBuilder<? super WebSecurityManager> bind)
Binds the security manager.
|
protected static <T extends PathMatchingFilter> |
config(Class<T> type,
String configValue)
Deprecated.
|
protected static <T extends PathMatchingFilter> |
config(com.google.inject.Key<T> baseKey,
String configValue)
Deprecated.
|
protected static <T extends PathMatchingFilter> |
config(com.google.inject.TypeLiteral<T> typeLiteral,
String configValue)
Deprecated.
|
protected void |
configureShiro()
Implement this method in order to configure your realms and any other Shiro customization you may need.
|
protected abstract void |
configureShiroWeb() |
protected static <T extends javax.servlet.Filter> |
filterConfig(Class<T> type,
String configValue)
Builds a FilterConfig from a Filer and configuration String
|
protected static <T extends javax.servlet.Filter> |
filterConfig(com.google.inject.Key<T> baseKey)
Builds a FilterConfig from a Filer and configuration String
|
protected static <T extends javax.servlet.Filter> |
filterConfig(com.google.inject.Key<T> baseKey,
String configValue)
Builds a FilterConfig from a Filer and configuration String
|
protected static <T extends javax.servlet.Filter> |
filterConfig(com.google.inject.TypeLiteral<T> typeLiteral,
String configValue)
Builds a FilterConfig from a Filer and configuration String
|
static com.google.inject.servlet.ServletModule |
guiceFilterModule() |
static com.google.inject.servlet.ServletModule |
guiceFilterModule(String pattern) |
add, bindBeanType, bindEventBus, bindRealm, configure, destroy
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, expose, expose, expose, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
public static final com.google.inject.Key<AnonymousFilter> ANON
public static final com.google.inject.Key<FormAuthenticationFilter> AUTHC
public static final com.google.inject.Key<BasicHttpAuthenticationFilter> AUTHC_BASIC
public static final com.google.inject.Key<NoSessionCreationFilter> NO_SESSION_CREATION
public static final com.google.inject.Key<LogoutFilter> LOGOUT
public static final com.google.inject.Key<PermissionsAuthorizationFilter> PERMS
public static final com.google.inject.Key<PortFilter> PORT
public static final com.google.inject.Key<HttpMethodPermissionFilter> REST
public static final com.google.inject.Key<RolesAuthorizationFilter> ROLES
public static final com.google.inject.Key<UserFilter> USER
public ShiroWebModule(javax.servlet.ServletContext servletContext)
public static void bindGuiceFilter(com.google.inject.Binder binder)
public static void bindGuiceFilter(String pattern, com.google.inject.Binder binder)
public static com.google.inject.servlet.ServletModule guiceFilterModule()
public static com.google.inject.servlet.ServletModule guiceFilterModule(String pattern)
protected final void configureShiro()
ShiroModule
configureShiro
in class ShiroModule
protected abstract void configureShiroWeb()
protected final void bindSecurityManager(com.google.inject.binder.AnnotatedBindingBuilder<? super SecurityManager> bind)
ShiroModule
DefaultSecurityManager
is bound as an eager singleton.bindSecurityManager
in class ShiroModule
protected void bindWebSecurityManager(com.google.inject.binder.AnnotatedBindingBuilder<? super WebSecurityManager> bind)
DefaultWebSecurityManager
is bound as an eager singleton.bind
- protected void bindSessionManager(com.google.inject.binder.AnnotatedBindingBuilder<SessionManager> bind)
DefaultWebSessionManager
is bound as an eager singleton.bindSessionManager
in class ShiroModule
bind
- protected final void bindEnvironment(com.google.inject.binder.AnnotatedBindingBuilder<Environment> bind)
ShiroModule
GuiceEnvironment
is bound as an eager singleton.bindEnvironment
in class ShiroModule
protected void bindWebEnvironment(com.google.inject.binder.AnnotatedBindingBuilder<? super WebEnvironment> bind)
protected final void addFilterChain(String pattern, com.google.inject.Key<? extends javax.servlet.Filter> key)
protected final void addFilterChain(String pattern, ShiroWebModule.FilterConfig<? extends javax.servlet.Filter>... filterConfigs)
filterConfig
s to a specific path pattern.FormAuthenticationFilter
.pattern
- URL patter to be mapped to a FilterConfig, e.g. '/my_private-path/**'filterConfigs
- FilterConfiguration representing the Filter and config to be used when processing resources on pattern
.protected static <T extends javax.servlet.Filter> ShiroWebModule.FilterConfig<T> filterConfig(com.google.inject.Key<T> baseKey, String configValue)
T
- A Servlet Filter class.baseKey
- The Key of the Filter class to be used.protected static <T extends javax.servlet.Filter> ShiroWebModule.FilterConfig<T> filterConfig(com.google.inject.Key<T> baseKey)
T
- A Servlet Filter class.baseKey
- The Key of the Filter class to be used.protected static <T extends javax.servlet.Filter> ShiroWebModule.FilterConfig<T> filterConfig(com.google.inject.TypeLiteral<T> typeLiteral, String configValue)
T
- A Servlet Filter class.typeLiteral
- The TyleLiteral of the filter key to be used.configValue
- the configuration used.protected static <T extends javax.servlet.Filter> ShiroWebModule.FilterConfig<T> filterConfig(Class<T> type, String configValue)
T
- A Servlet Filter class.type
- The filter to be used.configValue
- the configuration used.@Deprecated protected final void addFilterChain(String pattern, com.google.inject.Key<? extends javax.servlet.Filter>... keys)
PathMatchingFilter
, it will be registered with a proper
provider.pattern
- keys
- @Deprecated protected static <T extends PathMatchingFilter> com.google.inject.Key<T> config(com.google.inject.Key<T> baseKey, String configValue)
@Deprecated protected static <T extends PathMatchingFilter> com.google.inject.Key<T> config(com.google.inject.TypeLiteral<T> typeLiteral, String configValue)
@Deprecated protected static <T extends PathMatchingFilter> com.google.inject.Key<T> config(Class<T> type, String configValue)
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.