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

Setting permission to use servlet plugin

Damian Józefiak May 18, 2014

Hi,

I'm writing JIRA Servlet Plugin Module and I wanted to set some kind of permission to use my servlet, for example only users from group jira-admin can use this plugin and if user is anonymous (s)he must log in, but I have no idea how to do this. I thougth about creating Java filter, but I'm not sure if this is good idea here. Is there any other way to do this?

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
Nadir MEZIANI
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.
May 18, 2014

Hi,

In our company i have use this code in doGet methode to check if the user is logged

and you can check if the user is in jira-administrator group
if (jiraAuthenticationContext.getLoggedInUser()==null){
			String url = request.getContextPath()+"/login.jsp?permissionViolation=true&os_destination="+request.getRequestURI();
			StringBuffer stringBuffer = new StringBuffer();
			String fullUrl =(stringBuffer.append(url).append("?").append(request.getQueryString())).toString();
			response.sendRedirect(fullUrl);
		}

Damian Józefiak May 18, 2014

Works almost perfectly, but it looks like the path is broken, the path to my jira is https://hostname:port/jiraand i have repeated "/jira" in result of request.getRequestURI()
but I think I wil l handle it :) Thanks again :)

Nadir MEZIANI
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.
May 18, 2014

Hi,

Good luck.

Ankit Bhasin October 20, 2014

Hi, I got very similar requirement. But is it a good idea to hard-code the redirect URL (login.jsp). What if someone changes its login URL to use Single Sign On(SSO) or some other URL? Please have a look https://confluence.atlassian.com/display/JIRAKB/How+To+Change+JIRA+Login+and+Logout+URL

Geoff Wilson
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.
August 1, 2016

Did you ever write how to check if the user is in the jira-admin group? I don't see any code for that above

TAGS
AUG Leaders

Atlassian Community Events