Conventions

Yes, I’m using Debian Stretch.

At this point I’m too lazy to write more details.

Setup PostgreSQL

echo "deb http://kambing.ui.ac.id/postgresql/repos/apt/ stretch-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list
wget --quiet -O - http://kambing.ui.ac.id/postgresql/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install postgresql-10

Create new user and database.

sudo -u postgres createuser -D -A -P casig
sudo -u postgres createdb -O casig casigdb

Add access for all remote clients.

sudo tee -a /etc/postgresql/10/main/pg_hba.conf << EOF
host    all             all              0.0.0.0/0                       md5
host    all             all              ::/0                            md5
EOF

Restart PostgreSQL server.

sudo /etc/init.d/postgresql restart

CAS Service Registry

Add to CAS’ gradle build dependencies:

compile "org.apereo.cas:cas-server-support-jdbc-drivers:${project.'cas.version'}"
compile "org.apereo.cas:cas-server-support-jpa-service-registry:${project.'cas.version'}"

Add to etc/cas/config/cas.properties:

cas.serviceRegistry.jpa.url=jdbc:postgresql://192.0.2.9/casigdb
cas.serviceRegistry.jpa.user=casig
cas.serviceRegistry.jpa.password=cimeiwoh7pee4eeg0kae6Jaeyee3Oof7
cas.serviceRegistry.jpa.ddlAuto=update
cas.serviceRegistry.jpa.driverClass=org.postgresql.Driver
cas.serviceRegistry.jpa.dialect=org.hibernate.dialect.PostgreSQL95Dialect

Don’t forget the dialect or later we would not have DDL.

Default services

This would install default service for HTTPS/IMAPS. It should be automatically installed by CAS on the first run. But, hey, may be something goes wrong and we need to make our own service.

insert into regexregisteredservice (id, name, serviceid, evaluation_order)
  values (1, 'Generic HTTPS and IMAPS', '^(https?|imaps?|http?)://.*', 0);

Test

casigdb=> \dt
                          List of relations
 Schema |                    Name                    | Type  | Owner
--------+--------------------------------------------+-------+-------
 public | regexregisteredservice                     | table | casig
 public | regexregisteredserviceproperty             | table | casig
 public | registeredservice_contacts                 | table | casig
 public | registeredserviceimpl_props                | table | casig
 public | registeredserviceimplcontact               | table | casig
 public | samlregisteredservice_attributenameformats | table | casig
(6 rows)

References

JDBC Drivers, PostgreSQL Configuration Properties, Database Service Registry