001
014
015 package com.liferay.portal.kernel.servlet;
016
017 import java.security.Principal;
018
019 import javax.servlet.http.HttpServletRequest;
020 import javax.servlet.http.HttpServletRequestWrapper;
021
022
025 public class ProtectedServletRequest extends HttpServletRequestWrapper {
026
027 public ProtectedServletRequest(
028 HttpServletRequest request, String remoteUser) {
029
030 super(request);
031
032 _remoteUser = remoteUser;
033
034 if (remoteUser != null) {
035 _userPrincipal = new ProtectedPrincipal(remoteUser);
036 }
037 }
038
039 @Override
040 public String getRemoteUser() {
041 if (_remoteUser != null) {
042 return _remoteUser;
043 }
044 else {
045 return super.getRemoteUser();
046 }
047 }
048
049 @Override
050 public Principal getUserPrincipal() {
051 if (_userPrincipal != null) {
052 return _userPrincipal;
053 }
054 else {
055 return super.getUserPrincipal();
056 }
057 }
058
059 private String _remoteUser;
060 private Principal _userPrincipal;
061
062 }