Skip to content

Commit

Permalink
doc:merging attribute sources from Confluence(#2287)
Browse files Browse the repository at this point in the history
  • Loading branch information
555vedant committed Sep 27, 2024
1 parent cabca37 commit f4e7aa3
Showing 1 changed file with 36 additions and 24 deletions.
60 changes: 36 additions & 24 deletions docs/implement/user-attributes/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
# User Attributes
## User Attributes

This section describes how to configure your own sources of user attributes and integrate them into
uPortal.
This section describes how to configure your own sources of user attributes and integrate them into uPortal.

## First Time User Logins

:warning: The following three attributes are commonly used within uPortal and Apereo portlets:

* `uid`
* `username`
* `user.login.id`
* `uid`
* `username`
* `user.login.id`

The default (starting) configuration will provide these attributes for all users through the
`uPortalJdbcUserSource` bean. This bean, however, **only recognizes users who have logged into the
portal at least once** or who have been imported via Import/Export. It is **very important to map
these same 3 attributes** to an external source, such as LDAP or SAML.
The default (starting) configuration will provide these attributes for all users through the `uPortalJdbcUserSource` bean. This bean, however, **only recognizes users who have logged into the portal at least once** or who have been imported via Import/Export. It is **very important to map these same 3 attributes** to an external source, such as LDAP or SAML.

## Configuring User Attribute Data Sources

The basic class for a uPotal user is an implementation of the `IPerson` interface. The _uPortal
Person Directory Service_ is used to populate and retrieve user attributes. Person Directory is
maintained as an [independent project with its own source code called PersonDirectory][].
The basic class for a uPortal user is an implementation of the `IPerson` interface. The _uPortal Person Directory Service_ is used to populate and retrieve user attributes. Person Directory is maintained as an [independent project with its own source code called PersonDirectory][].
Attributes can be acquired from multiple sources via LDAP, JDBC, or other sources as required.

The Person Directory subsystem is based on concrete implementations of the `IPersonAttributeDao`
interface. These objects are Spring-managed beans. uPortal 5 comes pre-configured with several
instances of `IPersonAttributeDao`, but the most interesting (and most important!) sources of user
attribute information are the ones you provide yourself.
The Person Directory subsystem is based on concrete implementations of the `IPersonAttributeDao` interface. These objects are Spring-managed beans. uPortal 5 comes pre-configured with several instances of `IPersonAttributeDao`, but the most interesting (and most important!) sources of user attribute information are the ones you provide yourself.

Add your user attribute sources to uPortal by configuring beans that implement `IPersonAttributeDao`
and adding them to the Spring Application Context. uPortal will find the beans you declare and add
them to the User Attributes subsystem appropriately.

There are several ways to add beans to the uPortal Application Context using [uPortal-start][]. One
of the more common ways is to declare them in a Spring XML configuration file within the
`overlays/uPortal/src/main/resources/properties/contextOverrides/' directory.
Add your user attribute sources to uPortal by configuring beans that implement `IPersonAttributeDao` and adding them to the Spring Application Context. uPortal will find the beans you declare and add them to the User Attributes subsystem appropriately.

### Example `IPersonAttributeDao` Bean Definition

Expand Down Expand Up @@ -72,6 +57,33 @@ of the more common ways is to declare them in a Spring XML configuration file wi
</property>
</bean>

<!-- CachingPersonAttributeDaoImpl Bean Definition -->
<bean id="cachingMergedPersonAttributeDao" class="org.jasig.services.persondir.support.CachingPersonAttributeDaoImpl">
<property name="usernameAttributeProvider" ref="usernameAttributeProvider" />
<property name="cacheNullResults" value="true" />
<property name="userInfoCache">
<bean class="org.jasig.portal.utils.cache.MapCacheFactoryBean">
<property name="cacheFactory" ref="cacheFactory" />
<property name="cacheName" value="org.jasig.services.persondir.USER_INFO.merged" />
</bean>
</property>
<property name="cacheKeyGenerator" ref="userAttributeCacheKeyGenerator" />
<property name="cachedPersonAttributesDao">
<bean class="org.jasig.services.persondir.support.MergingPersonAttributeDaoImpl">
<property name="usernameAttributeProvider" ref="usernameAttributeProvider" />
<property name="merger">
<bean class="org.jasig.services.persondir.support.merger.ReplacingAttributeAdder" />
</property>
<property name="personAttributeDaos">
<list>
<ref bean="cachinguPortalJdbcAttributeSource"/>
<ref bean="cachinguPortalJdbcUserSource"/>
<ref bean="myunivCachingPersonDbJdbcAttributeSource"/><!-- **** ADDED HERE **** -->
</list>
</property>
</bean>
</property>
</bean>
</beans>
```

Expand Down

0 comments on commit f4e7aa3

Please sign in to comment.