Re: Default “deny”

Splash Forums Rewrite Users Default "deny" Re: Default “deny”

#22790

pavel.arnost
Participant

Hi Lincoln,

I tried 1.0.6-SNAPSHOT and it behaves differently, but it also doesn’t work. I attached simple project. Excerpt from ConfigurationProvider:

ConfigurationBuilder
.begin()
.addRule(Join.path("/index").to("/index.html")) // returns 403
.addRule(Join.path("/test").to("/test.html").perform(Lifecycle.handled())) // returns 404
.defineRule()
.when(Direction.isInbound().and(DispatchType.isRequest()))
.perform(Response.setCode(403));

And is it possible to do things like this?

HttpOperation loginRequiredCheck = new HttpOperation() {
public void performHttp(HttpServletRewrite event, EvaluationContext context) {
if (event instanceof HttpInboundServletRewrite) {
if (!userIsLoggedIn) {
// record current url in session and forward user to login page
} else {
// do forward as instructed in Join
}
}
}
};

ConfigurationBuilder
.begin()
.addRule(Join.path("/test").to("/test.html").perform(loginRequiredCheck)
...

Thanks,

Regards

Pavel