Fixing code for new authorization

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@131371 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-09-14 16:09:28 +00:00
parent 8c336b505e
commit 629207e097
1 changed files with 8 additions and 6 deletions

View File

@ -41,12 +41,14 @@ public class HeaderUtility {
String creator = org.gcube.informationsystem.model.embedded.Header.UNKNOWN_USER;
try {
Caller caller = AuthorizationProvider.instance.get();
ClientInfo clientInfo = caller.getClient();
String clientId = clientInfo.getId();
if (clientId != null && clientId.compareTo("") != 0) {
creator = clientId;
} else {
throw new Exception("Username null or empty");
if(caller!=null){
ClientInfo clientInfo = caller.getClient();
String clientId = clientInfo.getId();
if (clientId != null && clientId.compareTo("") != 0) {
creator = clientId;
} else {
throw new Exception("Username null or empty");
}
}
} catch (Exception e) {
logger.error("Unable to retrieve user");