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.
Community moderators have prevented the ability to post new answers.
You can check if there is authenticated user: https://docs.atlassian.com/jira/latest/com/atlassian/jira/security/JiraAuthenticationContext.html#getLoggedInUser--
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.