How to make a Servlet plugin module accessible only after login?

Miroslav Hornik June 7, 2016

This question is in reference to Atlassian Developer Documentation: Servlet Plugin Module

It seems that Servlet plugin makes the servlet accessible even without login to Jira. This could be noted in this article and also a hint how to make it accesible only after login would be good, thanks.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2016
Miroslav Hornik June 7, 2016

Thank you! The code in doGet looks like:

if (!ComponentAccessor.getJiraAuthenticationContext().isLoggedInUser()) {

Actually, now I wonder how to do it in a way that when a user is not logged in, a login is requested and then the target page is shown...? Thanks!

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2016

You can redirect to login. Quick search through JIRA sources gave me this:

private String redirectToLogin()
    {
        HttpServletRequest request = getHttpRequest();
        String returnURL = getCurrentURL();
        if (request.getQueryString() != null)
        {
            returnURL += "?" + request.getQueryString();
        }
        return getRedirect("/login.jsp?os_destination=" + JiraUrlCodec.encode(returnURL), false);
    }
TAGS
AUG Leaders

Atlassian Community Events