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?
Community moderators have prevented the ability to post new answers.
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); }
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Good luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.