X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=holmes-actions%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fholmes%2Fcommon%2Futils%2FUserUtil.java;h=5400b208103cc56235c3bcc7fb488f589a946816;hb=f00f74740e42d08cc6823d094b78aedf87e4cff8;hp=f0ff8d90afb25603c46dc053c4dca6e3a65151b3;hpb=f01cd76e0eb8f6a4ea78b26c60e3a37d7d4dd6ae;p=holmes%2Fcommon.git diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java index f0ff8d9..5400b20 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2022 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,10 @@ */ package org.onap.holmes.common.utils; -import javax.servlet.http.HttpServletRequest; import org.onap.holmes.common.constant.AlarmConst; +import javax.servlet.http.HttpServletRequest; + public class UserUtil { private UserUtil() { @@ -25,11 +26,7 @@ public class UserUtil { } public static String getUserName(HttpServletRequest request) { - String userName = AlarmConst.ADMIN; - String sessionName = request.getHeader("username"); - if (sessionName != null) { - userName = sessionName.toLowerCase(); - } - return userName; + return request.getHeader("username") == null ? + AlarmConst.ADMIN : request.getHeader("username"); } }