Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

The JPA Storage Service will be was removed in from V5 of the IdP, due in 2023. Please migrate prior to that pointupgrading the IdP.

Plugin Installation

Info

Starting with IdP 4.2 you can the install the latest plugin version supported on your IdP version with
.\plugin.sh -I net.shibboleth.plugin.storage.jdbc

Plugin ID

Module(s)

Latest Version

Bug Reporting

net.shibboleth.plugin.storage.jdbc

None

1

2.0.

1

0; download

https://shibboleth.atlassian.net/browse/JJDBC

For a detailed guide on how to install plugins, see here.

...

  • Locate the configuration (search for the class name org.opensaml.storage.impl.JPAStorageService

  • Remove the EntityManagerFactory bean, taking note of the dataSource property.

  • Remove also the VendorAdapter bean if present.

  • Change the StorageService bean

    • Replace class="org.opensaml.storage.impl.JPAStorageService" with parent="shibboleth.JDBCStorageService"

    • Remove the constructor parameter and instead add a pointer to the dataSource you noted above p:dataSource-ref="...."

...

Expand
titleMySQL
Code Block
languagesql
CREATE TABLE storagerecordsStorageRecords (
  context varchar(255) NOT NULL,
  id varchar(255) NOT NULL,
  expires bigint DEFAULT NULL,
  value text NOT NULL,
  version bigint NOT NULL,
  PRIMARY KEY (context, id)
);
Expand
titlePostgreSQL or H2
Code Block
CREATE TABLE storagerecordsStorageRecords (
  context varchar(255) NOT NULL,
  id varchar(255) NOT NULL,
  expires bigint DEFAULT NULL,
  value text NOT NULL,
  version bigint NOT NULL,
  PRIMARY KEY (context, id)
);
Expand
titleOracle
Code Block
CREATE TABLE storagerecords StorageRecords(
  context varchar2(255) NOT NULL,
  id varchar2(255) NOT NULL,
  expires number(19,0),
  value clob NOT NULL,
  version number(19,0) NOT NULL,
  PRIMARY KEY (context, id)
);
Expand
titleIBM DB2
Code Block
CREATE TABLE StorageRecords (
  context varchar(255) NOT NULL,
  id varchar(255) NOT NULL,
  expires bigint DEFAULT NULL,
  value clob NOT NULL,
  version bigint NOT NULL,
  PRIMARY KEY (context, id)
);

...

Expand
titleBehavioral Options

The behavior of the Storage Service is controlled by the following options

Option Property Name

Default

Description

dataSource

Required

The DataSource to use

cleanupInterval

“PT10M” (or the value of the property idp.storage.cleanupInterval if it is set)

The time between one cleanup and another. A value of 0 indicates that no cleanup will be performed.

retryableErrors

A comma separate list of SQL errors which will cause a failed transaction to be retried (a maximum of transactionRetry times)

transactionIsolation

8 (Connection.TRANSACTION_SERIALIZABLE)

The level of transactional isolation required as described for the Connection Interface
Starting in V2.0.0, if 0 (TRANSACTION_NONE) is specified then the transactional isolation is not set at the Connection level

transactionRetries

3

Number of retries if insertion fails due to database transaction bugs

verify

true

Whether to verify the database connection on startup

localLocking

false

Whether to do thread level locking to arbitrate access (for this IdP) to the the database. This can be useful in high contention situations when multiple transaction retries are happening.

contextSize

255

The size of the ‘context’ column in you database. Only change this if you are using a non-standard DDI

keySize

255

The size of the ‘key’ column in you database. Only change this if you are using a non-standard DDI

valueSize

Integer.MAX_SIZE (231)

The mazimum size of the ‘value’ column in you database. Only change this if you are using a non-standard DDI

...

Expand
titleOld JPA Configuration
Code Block
<bean id="shibboleth.JPAStorageService"
        class="org.opensaml.storage.impl.JPAStorageService"
        p:cleanupInterval="%{idp.storage.cleanupInterval:PT10M}"
        c:factory-ref="shibboleth.JPAStorageService.EntityManagerFactory" />

<bean id="shibboleth.JPAStorageService.EntityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="storageservice" />
    <property name="packagesToScan" value="org.opensaml.storage.impl" />
    <property name="dataSource" ref="shibboleth.JPAStorageService.DataSource" />
    <property name="jpaVendorAdapter" ref="shibboleth.JPAStorageService.JPAVendorAdapter" />
    <property name="jpaDialect">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
    </property>
</bean>

<bean id="shibboleth.JPAStorageService.JPAVendorAdapter"
    class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="database" value="MYSQL" />
</bean>
Expand
titleAfter Initial conversion
Code Block
<bean id="shibboleth.JPAStorageService" 
      parent="shibboleth.JDBCStorageService"
      p:cleanupInterval="%{idp.storage.cleanupInterval:PT10M}"
      p:dataSource-ref="shibboleth.JPAStorageService.DataSource"/>

...