Reply To: Rewrite + Apache Shiro

Splash Forums Rewrite Users Rewrite + Apache Shiro Reply To: Rewrite + Apache Shiro

#23797

zozan
Participant

Sure.
shiro.ini
[main]
authc.loginUrl = /Login.xhtml
user.loginUrl = /Login.xhtml
authc.successUrl = ../admin/index.xhtml

[users]
naska = naska

[urls]
/Login.xhtml = authc
/admin/** = authc

CustomRewriteConfigurationProvider:
public Configuration getConfiguration(final ServletContext context)
{
return ConfigurationBuilder.begin()
.addRule()
.when(Direction.isInbound().and(Path.matches("/some/{page}/")))
.perform(Forward.to("/new-{page}/"))
// initial redirect to /home
.addRule()
.when(Path.matches("/"))
.perform(Redirect.temporary(context.getContextPath() + "/Home"))

.addRule(Join.path("/{Home}").to("/{Home}.xhtml")
.withInboundCorrection())
.when(DispatchType.isRequest())
.where("Home").matches("[^/.]+");
}