use of org.apache.pluto.container.om.portlet.UserAttribute in project uPortal by Jasig.
the class RequestAttributeServiceImpl method getMultiValuedUserInfoMap.
/**
* @param remoteUser
* @param expectedUserAttributes
* @return an unmodifiable map containing the multi-valued attributes for the user within the
* list of expected attributes
*/
protected Map<String, List<Object>> getMultiValuedUserInfoMap(String remoteUser, List<? extends UserAttribute> expectedUserAttributes) {
final IPersonAttributes personAttributes = this.personAttributeDao.getPerson(remoteUser);
if (personAttributes == null) {
return Collections.emptyMap();
}
final Map<String, List<Object>> resultUserInfoMap = new HashMap<String, List<Object>>(expectedUserAttributes.size());
// Copy expected attributes to the USER_INFO Map
final Map<String, List<Object>> attributes = personAttributes.getAttributes();
for (final UserAttribute userAttributeDD : expectedUserAttributes) {
final String userAttributeName = userAttributeDD.getName();
// containsKey check to handle attributes with a single null value
if (attributes.containsKey(userAttributeName)) {
final List<Object> list_valueObjs = attributes.get(userAttributeName);
resultUserInfoMap.put(userAttributeName, list_valueObjs);
}
}
return Collections.unmodifiableMap(resultUserInfoMap);
}
use of org.apache.pluto.container.om.portlet.UserAttribute 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.apache.pluto.container.om.portlet.UserAttribute in project uPortal by Jasig.
the class PersonDirectoryUserInfoService method generateUserInfo.
/**
* Using the Map of portal user attributes and a List of expected attributes generate the
* USER_INFO map for the portlet
*
* @param portalUserAttributes All the attributes the portal knows about the user
* @param expectedUserAttributes The attributes the portlet expects to get
* @return The Map to use for the USER_INFO attribute
*/
protected Map<String, String> generateUserInfo(final IPersonAttributes personAttributes, final List<? extends UserAttribute> expectedUserAttributes, HttpServletRequest httpServletRequest) {
final Map<String, String> portletUserAttributes = new HashMap<String, String>(expectedUserAttributes.size());
// Copy expected attributes to the USER_INFO Map
final Map<String, List<Object>> attributes = personAttributes.getAttributes();
for (final UserAttribute userAttributeDD : expectedUserAttributes) {
final String attributeName = userAttributeDD.getName();
// null then put the key with no value in the returned map
if (attributes.containsKey(attributeName)) {
final Object valueObj = personAttributes.getAttributeValue(attributeName);
final String value = valueObj == null ? null : String.valueOf(valueObj);
portletUserAttributes.put(attributeName, value);
}
}
return portletUserAttributes;
}
use of org.apache.pluto.container.om.portlet.UserAttribute in project uPortal by Jasig.
the class CasTicketUserInfoService method isCasProxyTicketRequested.
/**
* Determine whether the portlet has expects a CAS proxy ticket as one of the user attributes.
*
* @param request portlet request
* @param plutoPortletWindow portlet window
* @return <code>true</code> if a CAS proxy ticket is expected, <code>false</code> otherwise
* @throws PortletContainerException if expeced attributes cannot be determined
*/
public boolean isCasProxyTicketRequested(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 proxy ticket 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.proxyTicketKey))
return true;
}
// if the proxy ticket key wasn't found in the list of requested attributes
return false;
}
Aggregations