Class AbstractPageAuthorizationStrategy
- java.lang.Object
-
- org.apache.wicket.authorization.IAuthorizationStrategy.AllowAllAuthorizationStrategy
-
- org.apache.wicket.authorization.strategies.page.AbstractPageAuthorizationStrategy
-
- All Implemented Interfaces:
IAuthorizationStrategy
- Direct Known Subclasses:
SimplePageAuthorizationStrategy
public abstract class AbstractPageAuthorizationStrategy extends IAuthorizationStrategy.AllowAllAuthorizationStrategy
An abstract base class for implementing simple authorization of Pages. Users should overrideisPageAuthorized(Class)
, which gets called for Page classes when they are being constructed.- Author:
- Jonathan Locke, Eelco Hillenius
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.wicket.authorization.IAuthorizationStrategy
IAuthorizationStrategy.AllowAllAuthorizationStrategy
-
-
Field Summary
-
Fields inherited from interface org.apache.wicket.authorization.IAuthorizationStrategy
ALLOW_ALL
-
-
Constructor Summary
Constructors Constructor Description AbstractPageAuthorizationStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
instanceOf(Class<?> type, Class<?> superType)
Works like instanceof operator where instanceOf(a, b) is the runtime equivalent of (a instanceof b).<T extends IRequestableComponent>
booleanisInstantiationAuthorized(Class<T> componentClass)
Checks whether an instance of the given component class may be created.protected <T extends Page>
booleanisPageAuthorized(Class<T> pageClass)
Whether to page may be created.-
Methods inherited from class org.apache.wicket.authorization.IAuthorizationStrategy.AllowAllAuthorizationStrategy
isActionAuthorized, isResourceAuthorized
-
-
-
-
Constructor Detail
-
AbstractPageAuthorizationStrategy
public AbstractPageAuthorizationStrategy()
-
-
Method Detail
-
isInstantiationAuthorized
public final <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass)
Description copied from interface:IAuthorizationStrategy
Checks whether an instance of the given component class may be created. If this method returns false, theIUnauthorizedComponentInstantiationListener
that is configured in thesecurity settings
will be called. The default implementation of that listener throws aUnauthorizedInstantiationException
.If you wish to implement a strategy that authenticates users which cannot access a given Page (or other Component), you can simply throw a
RestartResponseAtInterceptPageException
in your implementation of this method.- Specified by:
isInstantiationAuthorized
in interfaceIAuthorizationStrategy
- Overrides:
isInstantiationAuthorized
in classIAuthorizationStrategy.AllowAllAuthorizationStrategy
- Parameters:
componentClass
- The component class to check- Returns:
- Whether the given component may be created
- See Also:
IAuthorizationStrategy.isInstantiationAuthorized(java.lang.Class)
-
instanceOf
protected boolean instanceOf(Class<?> type, Class<?> superType)
Works like instanceof operator where instanceOf(a, b) is the runtime equivalent of (a instanceof b).- Parameters:
type
- The type to checksuperType
- The interface or superclass that the type needs to implement or extend- Returns:
- True if the type is an instance of the superType
-
isPageAuthorized
protected <T extends Page> boolean isPageAuthorized(Class<T> pageClass)
Whether to page may be created. Returns true by default.- Type Parameters:
T
- the type of the page- Parameters:
pageClass
- The Page class- Returns:
- True if to page may be created
-
-