Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Force a user to be logged out using API

Eric Kim October 30, 2012

Hi, I am developing a confluence plugin that has to implement a function which forces a user who just logged in to be logged out. What I was trying to do was to use LoginEvent from Confluence API and use sessionId and/or ConfluenceAuthenticator.logout() method to force the user to be logged out.

public class LoginListener implements DisposableBean {

    private static final Logger log = LoggerFactory.getLogger(LoginListener.class);
   
    protected EventPublisher eventPublisher;
   
    private HttpServletRequest request;
    private HttpServletResponse response;

    public LoginListener(EventPublisher eventPublisher) {
        eventPublisher.register(this);
    }
   
    @EventListener
    public void loginEvent(LoginEvent event) throws AuthenticatorException {
        String sessionId = event.getSessionId();
        ConfluenceAuthenticator ca = (ConfluenceAuthenticator)event.getSource();
        ca.logout(ServletActionContext.request, ServletActionContext.response);
    }

    @Override
    public void destroy() throws Exception {
        // TODO Auto-generated method stub
    }
}


Any suggestions?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Eric Kim November 15, 2012

Looks like there are no 'formal' way to do it, I just made it redirected to logout.action

0 votes
Eric Kim November 1, 2012

it should not be redirecting to logout.action

TAGS
AUG Leaders

Atlassian Community Events