use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class CachedPasswordUserInfoService method isPasswordRequested.
/**
* Determine whether the portlet has expects a password as one of the user attributes.
*
* @param request portlet request
* @param plutoPortletWindow portlet window
* @return <code>true</code> if a password is expected, <code>false</code> otherwise
* @throws PortletContainerException if expeced attributes cannot be determined
*/
public boolean isPasswordRequested(PortletRequest request, PortletWindow plutoPortletWindow) throws PortletContainerException {
// get the list of requested user attributes
final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
final PortletApplicationDefinition portletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinition.getPortletDefinitionId());
// check to see if the password key is one of the requested user attributes
List<? extends UserAttribute> requestedUserAttributes = portletApplicationDescriptor.getUserAttributes();
for (final UserAttribute userAttributeDD : requestedUserAttributes) {
final String attributeName = userAttributeDD.getName();
if (attributeName.equals(this.passwordKey))
return true;
}
// if the password key wasn't found in the list of requested attributes
return false;
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PersonDirectoryUserInfoService method getUserInfo.
/* (non-Javadoc)
* @see org.apache.pluto.spi.optional.UserInfoService#getUserInfo(javax.portlet.PortletRequest, org.apache.pluto.PortletWindow)
*/
@Override
public Map<String, String> getUserInfo(PortletRequest request, PortletWindow plutoPortletWindow) throws PortletContainerException {
// Get the remote user
final String remoteUser = request.getRemoteUser();
if (remoteUser == null) {
return null;
}
final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
return this.getUserInfo(remoteUser, httpServletRequest, portletWindow);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletEnvironmentServiceImpl method createPortletSession.
@Override
public PortletSession createPortletSession(PortletContext portletContext, PortletWindow portletWindow, HttpSession session) {
// TODO pluto 1.1 PortletEnvironmentService#createPortletSession passed in the request; now
// use IPortalRequestUtils#getCurrentPortalRequest()?
final HttpServletRequest request = portalRequestUtils.getCurrentPortalRequest();
final IPortletWindow internalPortletWindow = this.portletWindowRegistry.convertPortletWindow(request, portletWindow);
final IPortletEntity portletEntity = internalPortletWindow.getPortletEntity();
final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
return new ScopingPortletSessionImpl(portletEntityId, portletContext, portletWindow, session);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class RequestAttributeServiceImpl method getAttribute.
/*
* (non-Javadoc)
* @see org.apereo.portal.portlet.container.services.RequestAttributeService#getAttribute(javax.portlet.PortletRequest, org.apache.pluto.container.PortletWindow, java.lang.String)
*/
@Override
public Object getAttribute(HttpServletRequest httpServletRequest, PortletWindow plutoPortletWindow, String attributeName) {
if (IPortletRenderer.MULTIVALUED_USERINFO_MAP_ATTRIBUTE.equals(attributeName)) {
// Get the list of user attributes the portal knows about the user
final String remoteUser = httpServletRequest.getRemoteUser();
if (remoteUser == null) {
return null;
}
final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
final List<? extends UserAttribute> expectedUserAttributes = this.getExpectedUserAttributes(httpServletRequest, portletWindow);
return getMultiValuedUserInfoMap(remoteUser, expectedUserAttributes);
}
return null;
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletWindowRegistryImpl method getPortletWindow.
/* (non-Javadoc)
* @see org.apereo.portal.portlet.registry.IPortletWindowRegistry#getPortletWindow(javax.servlet.http.HttpServletRequest, org.apereo.portal.portlet.om.IPortletWindowId)
*/
@Override
public IPortletWindow getPortletWindow(HttpServletRequest request, IPortletWindowId portletWindowId) {
Validate.notNull(request, "request can not be null");
Validate.notNull(portletWindowId, "portletWindowId can not be null");
final PortletWindowCache<IPortletWindow> portletWindowMap = getPortletWindowMap(request);
IPortletWindow portletWindow = portletWindowMap.getWindow(portletWindowId);
if (portletWindow != null) {
logger.trace("Found IPortletWindow {} in request cache", portletWindow.getPortletWindowId());
return portletWindow;
}
final PortletWindowIdImpl localPortletWindowId = this.convertPortletWindowId(request, portletWindowId);
// Find the window data from the correct window data map
final PortletWindowData portletWindowData;
if (STATELESS_PORTLET_WINDOW_ID.equals(localPortletWindowId.getWindowInstanceId())) {
final PortletWindowCache<PortletWindowData> statelessPortletWindowDataMap = this.getStatelessPortletWindowDataMap(request, false);
if (statelessPortletWindowDataMap != null) {
portletWindowData = statelessPortletWindowDataMap.getWindow(portletWindowId);
} else {
portletWindowData = null;
}
} else {
portletWindowData = this.getPortletWindowData(request, portletWindowId);
}
if (portletWindowData == null) {
logger.trace("No IPortletWindow {} exists, returning null", portletWindowId);
return null;
}
portletWindow = this.wrapPortletWindowData(request, portletWindowData);
// Cache the wrapped window in the request
return portletWindowMap.storeIfAbsentWindow(portletWindow);
}
Aggregations