001
014
015 package com.liferay.portal.kernel.portlet;
016
017 import com.liferay.portal.kernel.servlet.ProtectedPrincipal;
018
019 import java.security.Principal;
020
021 import javax.portlet.ActionRequest;
022 import javax.portlet.filter.ActionRequestWrapper;
023
024
027 public class ProtectedActionRequest extends ActionRequestWrapper {
028
029 public ProtectedActionRequest(
030 ActionRequest actionRequest, String remoteUser) {
031
032 super(actionRequest);
033
034 _remoteUser = remoteUser;
035
036 if (remoteUser != null) {
037 _userPrincipal = new ProtectedPrincipal(remoteUser);
038 }
039 }
040
041 public String getRemoteUser() {
042 if (_remoteUser != null) {
043 return _remoteUser;
044 }
045 else {
046 return super.getRemoteUser();
047 }
048 }
049
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 }