/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2022 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
*/\r
package org.onap.holmes.common.utils;\r
\r
-import javax.servlet.http.HttpServletRequest;\r
import org.onap.holmes.common.constant.AlarmConst;\r
\r
+import javax.servlet.http.HttpServletRequest;\r
+\r
public class UserUtil {\r
\r
private UserUtil() {\r
}\r
\r
public static String getUserName(HttpServletRequest request) {\r
- String userName = AlarmConst.ADMIN;\r
- String sessionName = request.getHeader("username");\r
- if (sessionName != null) {\r
- userName = sessionName.toLowerCase();\r
- }\r
- return userName;\r
+ return request.getHeader("username") == null ?\r
+ AlarmConst.ADMIN : request.getHeader("username");\r
}\r
}\r