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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.