0

best way to interrupt the page create

asked 2018-11-27 11:10:14 +0800

superium gravatar image superium
29 4

i would like to interrupt the page create if user not logged in,but ...

public class Authentication implements Initiator,InitiatorExt {
    private final Logger logger = Logger.getLogger(Authentication.class);

    @Override
    public void doInit(Page page, Map<String, Object> args) throws Exception {
        if (....) {
            Executions.sendRedirect("/login.zul");
            throw new Exception("not authenticated!");  //without this, the page will be created before redirect to login.zul.
                                    //with this, the console and client got an "not authenticated!" Exception .
        }
    }

    @Override
    public boolean doCatch(Throwable ex) throws Exception {

        return false;
    }

    ....
}
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-05-03 11:28:27 +0800

cor3000 gravatar image cor3000
4531 2 7
ZK Team

Most security libraries (e.g. spring security, apache shiro, cas, ...) do this at a lower level, e.g. using a servlet filter, which can perform the redirect, before entering the application logic.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2018-11-27 11:10:14 +0800

Seen: 7 times

Last updated: May 03

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More