Page tree

Previous Stable Release

Please note that the V3 release branch is now the previous stable release, with the current stable releases from the V4 branch.
Support for V3 will end on Dec 31, 2020.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

The RelationalDatabase data connector allows creation of multiple attributes from a relational database specified via JDBC.

Schema Name and Location

This contents of elements of this type are defined by the urn:mace:shibboleth:2.0:resolver:dc schema, which can be located at http://shibboleth.net/schema/idp/shibboleth-attribute-resolver-dc.xsd.  

Examples

Simple DataConnector entirely in custom syntax
 <resolver:DataConnector id="myDatabase" xsi:type="dc:RelationalDatabase">
   <resolver:FailoverDataConnector ref="BackupDataseConnector"/>
   <dc:ApplicationManagedConnection 
       jdbcDriver="org.hsqldb.jdbc.JDBCDriver" jdbcURL="jdbc:hsqldb:mem:RDBMSDataConnectorStore"
       jdbcUserName="SA" jdbcPassword="" />
   <dc:QueryTemplate>
       <![CDATA[
         SELECT * FROM people WHERE userid='$resolutionContext.Principal'
       ]]>
   </dc:QueryTemplate>
 
   <dc:Column columnName="homephone" attributeID="phonenumber" />
       
   <dc:ResultCache elementTimeToLive="PT10S"/>
</resolver:DataConnector>
Simple Data Connector using external beans
<resolver:DataConnector id="myDatabase" xsi:type="dc:RelationalDatabase" mappingStrategy="MappingBeanId">
  <dc:BeanManagedConnection>DataConnectorBeanId</dc:BeanManagedConnection>
   <dc:QueryTemplate>
       <![CDATA[
         SELECT * FROM people WHERE userid='$resolutionContext.Principal'
       ]]>
   </dc:QueryTemplate>
  <dc:ResultCacheBean>ResultCacheBeanId<\dc:ResultCacheBean>
</resolver:DataConnector>

Attributes

Any of the common attributes can be specified. In addition the following attributes may be specified:

NameTypeDefaultDescription

noResultIsError

booleanfalseControls whether an empty result set is an error

mappingStrategyRef

bean definition The id of a Spring bean defining a MappingStrategy <ResultSet >

multipleResultsIsError

booleanfalseControls whether  a result set with more than one result is an error

queryTimeout

XML Duration or number of milliseconds A timeout for the queries made against the data base
springResource  File definition A file containing Spring definitions suitable for injecting into a RDBMSDataConnector or AbstractSearchDataConnector

templateEngine

bean definition The id of a Spring bean defining a Velocity Engine

Child Elements

Any of the common child elements can be specified. In addition the following may be specified:

NameCardinalityDescription

<ContainerManagedConnection>


Exactly 1 (all three elements)

Must be 0 if the
springResource
attribute is supplied

Connects to a database via a JNDI connection

<ApplicationManagedConnection>

Connects to a database by a JDBC URL

<BeanManagedConnection>

Connects to a database via an externally specified DataSource,
the Spring bean id of which is supplied as the content of the element

<QueryTemplate>

0 or 1The template of the SQL query to send to the database

<Column>

0 or moreA series of definitions which map column name to attribute ID

<ResultCache>


0 or 1 (both elements

The definition of how results should be cached

<ResultCacheBean>

The definition of how results should be cached as an externally defined com.google.common.cache.Cache<String,Map<String,IdPAttribute>>,
the Spring bean id of which is supplied as the content of the element

Externally (Spring) Defined Content

The RelationalDatabase connector allows externally defined beans to be specified in 5 places:

  1. The entire configuration can be controlled via a non-inheriting Spring file specified via the springResource  attribute.
  2. The data source can be specified as an externally defined bean via the <BeanManagedConnection> element (as a replacement for either the <ContainerManagedConnection> or the <ApplicationManagedConnection> element).
  3. The mapping of column names can be specified as an externally defined bean via the mappingStrategyRef element (as a replacement for the <Column> elements).
  4. The caching of results can be specified as an externally defined bean via the <ResultCacheBean> element (as a replacement for the <ResultCache> element).
  5. Rarely, a non default Velocity engine can be injected via the templateEngine attribute.

Notes

tbd

 

  • No labels