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; String creator = org.gcube.informationsystem.model.embedded.Header.UNKNOWN_USER;
try { try {
Caller caller = AuthorizationProvider.instance.get(); Caller caller = AuthorizationProvider.instance.get();
ClientInfo clientInfo = caller.getClient(); if(caller!=null){
String clientId = clientInfo.getId(); ClientInfo clientInfo = caller.getClient();
if (clientId != null && clientId.compareTo("") != 0) { String clientId = clientInfo.getId();
creator = clientId; if (clientId != null && clientId.compareTo("") != 0) {
} else { creator = clientId;
throw new Exception("Username null or empty"); } else {
throw new Exception("Username null or empty");
}
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("Unable to retrieve user"); logger.error("Unable to retrieve user");