diff options
-rw-r--r-- | src/main/java/org/onap/crud/service/CrudRestService.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/onap/crud/service/CrudRestService.java b/src/main/java/org/onap/crud/service/CrudRestService.java index a43d7e5..25ab43a 100644 --- a/src/main/java/org/onap/crud/service/CrudRestService.java +++ b/src/main/java/org/onap/crud/service/CrudRestService.java @@ -22,6 +22,7 @@ package org.onap.crud.service; import java.security.cert.X509Certificate; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -786,7 +787,9 @@ public class CrudRestService { X500Principal subjectDn = clientCert.getSubjectX500Principal(); authUser = subjectDn.toString(); } - isValid = this.auth.validateRequest(authUser.toLowerCase(), action.toString() + ":" + authPolicyFunctionName); + if(null != authUser) { + isValid = this.auth.validateRequest(authUser.toLowerCase(), action.toString() + ":" + authPolicyFunctionName); + } } catch (Exception e) { logResult(action, uri, e); return false; @@ -819,7 +822,7 @@ public class CrudRestService { void logResult(Action op, String uri, Exception e) { - logger.error(CrudServiceMsgs.EXCEPTION_DURING_METHOD_CALL, op.toString(), uri, e.getStackTrace().toString()); + logger.error(CrudServiceMsgs.EXCEPTION_DURING_METHOD_CALL, op.toString(), uri, Arrays.toString(e.getStackTrace())); // Clear the MDC context so that no other transaction inadvertently // uses our transaction id. |