Die folgende Dokumentation gilt für Tomcats, die nicht über Keycloak abgesichert werden.
CAS (Central Authentication Service)
CAS ist eine Enterprise Single Sign-On Lösung für Web Services. Mehr Infos unter Apereo Seite https://apereo.github.io/cas/index.html
Architektur
IT-Landschaftsbild:
CAS Server bauen
1.Runterladen des Template
Um den CAS Server zu bauen, muss zuerst das CAS WAR Overlay Template runtergeladen werden. Unter https://github.com/apereo/cas-overlay-template ist das Template cas-overlay-template-master.zip zu runterladen.
Nach dem Entzippen des Template sieht die Struktur wie folgt aus:
2.Customizing des CAS Server
Verzeichnis src und alle benötigten Unterverzeichnisse müssen zuerst angelegt werden.
Dann müssen alle Customizing Dateien in der richtigen Position abgelegt werden.
Beispiel
3.Bauen des Server
Mit dem Befehl build.sh package wird der Server gebaut.
Nach dem Build-Prozess wird das Deployment cas.war unter target erstellt.
Customizing des CAS Server
Datenbank
Unter src\main\resources muss die Einstellung für LDAP in Datei application.properties angepasst werden:
cas.authn.jdbc.query[0].healthQuery=SELECT 1
cas.authn.jdbc.query[0].sql=SELECT password FROM B2BBP_ADM_ACCOUNT WHERE userid=?
cas.authn.jdbc.query[0].url=jdbc:postgresql://localhost:5432/postgres
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.PostgreSQLDialect
cas.authn.jdbc.query[0].user=user
cas.authn.jdbc.query[0].password=password
cas.authn.jdbc.query[0].driverClass=org.postgresql.Driver
cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULT
cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5
Mehr Infos unter https://apereo.github.io/cas/development/installation/Database-Authentication.html
LDAP
Unter src\main\resources muss die Einstellung für LDAP in Datei application.properties angepasst werden:
cas.authn.ldap[0].type=AD
cas.authn.ldap[0].ldapUrl=ldap://testserver.nli.local:389
cas.authn.ldap[0].useSsl=false
cas.authn.ldap[0].useStartTls=false
cas.authn.ldap[0].connectTimeout=5000
cas.authn.ldap[0].userFilter=sAMAccountName={user}
cas.authn.ldap[0].subtreeSearch=true
cas.authn.ldap[0].baseDn=OU=cl05b2bd01,OU=application,OU=group,OU=integration,DC=nli,DC=local
cas.authn.ldap[0].bindDn=t_ldapreader@nli.local
cas.authn.ldap[0].dnFormat=%s@nli.local
cas.authn.ldap[0].bindCredential=testpasword
cas.authn.ldap[0].principalAttributeId={user}
cas.authn.ldap[0].principalAttributePassword=
cas.authn.ldap[0].principalAttributeList=sAMAccountName,sn,cn,givenName,displayName
Mehr Infos unter https://apereo.github.io/cas/5.0.x/installation/LDAP-Authentication.html
Service Registration
Wenn eine Authentifizierungasnforderung bei dem CAS Login Endpoint eintrifft, wird die Zielapplikation als ein URL angezeigt, der in CAS Service Registry geprüft wird, um entschieden zu werden, ob die Applikation CAS benutzen darf oder nicht. Aus diesem Grund muss die B2B als Service im CAS registriert werden. Ein Beispiel
unter \src\main\resources\b2b-1.json
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^http://.*",
"name" : "B2B",
"theme" : "apereo",
"id" : 1,
"description" : "B2BBP BY PRACTICE",
"evaluationOrder" : 1
}
Mehr Info unter https://apereo.github.io/cas/5.1.x/installation/Service-Management.html
UI
Die Login-Maske kann customized werden. Infos unter https://apereo.github.io/cas/5.1.x/installation/User-Interface-Customization.html
Einstellung im Tomcat
Die Konfigdatei b2bbp-engine.xml unter tomcathome/conf/Catalina/localhost muss wie folgt angepasst werden:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/b2bbp-engine" reloadable="true" crossContext="true">
<Resource name="jdbc/b2bbp"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/db_05_nli_b2bd01"
username="t_05_705_b2bd01_u"
password="password"
maxTotal="40"
maxIdle="10"
maxWaitMillis="180000"
removeAbandonedTimeout="120"
removeAbandoned="false"
logAbandoned="true"/>
<Environment description="" name="cas/serverName" override="false" type="java.lang.String" value="http://172.16.45.107:8011" />
<Environment description="" name="cas/AuthenticationFilter/casServerLoginUrl" override="false" type="java.lang.String" value="http://172.16.45.107:8011/cas/login" />
<Environment description="" name="cas/Cas20ProxyReceivingTicketValidationFilter/casServerUrlPrefix" override="false" type="java.lang.String" value="http://172.16.45.107:8011/cas" />
</Context>