It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Miroslav Hornik Jun 07, 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

Miroslav Hornik Jun 07, 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 Jun 07, 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);
    }

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in United States

Topic Tuesday: Agile

Another week, another Topic Tuesday!  Agile has been on my mind a lot lately because I've seen good implementations and bad implementations, but now as a Jira admin it matters more to me whether...

27 views 0 0
View post

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you