Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix: AtlassianHostUser is null in Jira cloud plugin

Vikash Kumar May 14, 2019

My controller looks like this

@Controller
@IgnoreJwt
public class MainController {

private final StorageService storageService;

@Autowired
public MainController(StorageService storageService) {
this.storageService = storageService;
}
.
.
.
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public String handleFileUpload(@AuthenticationPrincipal AtlassianHostUser hostUser,
@RequestParam("file") MultipartFile file,
RedirectAttributes redirectAttributes) {

hostUser.getUserKey(); // Causing NPE because hostUser is null

My descriptor is shown below

{
"key": "copy-paste-plugin",
"baseUrl": "${addon.base-url}",
"name": "Copy Paste (Spring Boot)",
"authentication": {
"type": "jwt"
},
"lifecycle": {
"installed": "/installed",
"uninstalled": "/uninstalled"
},
"scopes": [
"READ",
"ACT_AS_USER"
],

"modules": {
"generalPages": [
{
"url": "/upload",
"key": "upload",
"location": "none",
"name": {
"value": "Attach a file"
},
"conditions": [
{
"condition": "user_is_logged_in"
}
]
}
]
}
}

What am I missing in above code which is causing AtlassianHostUser as null?

 

Thank you!

 

1 answer

0 votes
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2019

Hey Vikash,

I just wanted to follow up with you since nobody has answered this question yet and I see you've got a few other questions in previous years about plugin development! The developer involvement here on our regular Community site is not as high as standard users/administrators.

We have a dedicated Developer Community that might be good to check out for plugin development related questions. Since the topics are more focused, it's easier for other developers to watch the questions coming in and provide guidance.

Cheers,
Daniel

Suggest an answer

Log in or Sign up to answer