Search in sources :

Example 66 with IPortletWindow

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;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) PortletApplicationDefinition(org.apache.pluto.container.om.portlet.PortletApplicationDefinition) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) UserAttribute(org.apache.pluto.container.om.portlet.UserAttribute) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 67 with IPortletWindow

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);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 68 with IPortletWindow

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);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) ScopingPortletSessionImpl(org.apereo.portal.portlet.session.ScopingPortletSessionImpl) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletEntityId(org.apereo.portal.portlet.om.IPortletEntityId)

Example 69 with IPortletWindow

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;
}
Also used : IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 70 with IPortletWindow

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);
}
Also used : IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Aggregations

IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)88 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)32 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)32 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)23 HttpServletRequest (javax.servlet.http.HttpServletRequest)13 IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)12 IUserInstance (org.apereo.portal.user.IUserInstance)12 List (java.util.List)10 IPortletEntityId (org.apereo.portal.portlet.om.IPortletEntityId)10 IPortletUrlBuilder (org.apereo.portal.url.IPortletUrlBuilder)9 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)9 IOException (java.io.IOException)8 IUserLayoutManager (org.apereo.portal.layout.IUserLayoutManager)7 WindowState (javax.portlet.WindowState)6 IUserPreferencesManager (org.apereo.portal.IUserPreferencesManager)6 IPortalUrlBuilder (org.apereo.portal.url.IPortalUrlBuilder)6 LinkedHashMap (java.util.LinkedHashMap)5 Locale (java.util.Locale)5 PortletException (javax.portlet.PortletException)5 PortletMode (javax.portlet.PortletMode)5