CORS support for ContainerManager Northbound APIs
[controller.git] / opendaylight / northbound / containermanager / src / main / java / org / opendaylight / controller / containermanager / northbound / ContainerManagerNorthbound.java
index e2e1a62325e8198a0367da866d6298e75cd6a81f..77c3004c76b6928fb57631ffd1a4c99e4740a067 100644 (file)
@@ -72,9 +72,9 @@ public class ContainerManagerNorthbound {
 
     @Context
     public void setSecurityContext(SecurityContext context) {
-        Principal principal;
-        principal = context.getUserPrincipal();
-        username = principal.getName();
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
     }
 
     protected String getUserName() {