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

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

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!

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);

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Thursday in Agile

How Scrum works? It starts with training and education

To answer “How scrum works,” most of the teams I've worked with first addressed the question: “where to start?”  That question applies to both implementation and improvements on the Scrum framew...

214 views 3 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you