A Spring Boot application that integrates with University of Illinois Chicago's Shibboleth Single Sign-On (SSO) system for authentication and user management.
- Overview
- Features
- Architecture
- Prerequisites
- Project Setup
- Configuration
- Running the Application
- Authentication Modes
- Apache Configuration
- SSL Configuration
- Database
- API Endpoints
- Development
- Deployment
- Troubleshooting
This application provides a secure web interface that authenticates users through UIC's Shibboleth Identity Provider (I-Trust Federation Registry) (https://itrust.illinois.edu/federationregistry/). It supports both production Shibboleth authentication and local development authentication for testing purposes.
- Shibboleth SSO Integration: Seamless authentication with UIC's identity system
- Dual Authentication Modes: Production (Shibboleth) and Development (local) modes
- User Management: Automatic user creation from Shibboleth attributes
- Attribute Mapping: Maps Shibboleth attributes to user entities
- Error Handling: Custom error pages for common HTTP errors
- H2 Database: In-memory database for development and testing
- REST API: JSON endpoints for user data retrieval
- Bootstrap UI: Clean, responsive web interface
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ Apache HTTPD │ │ Spring Boot App │ │ H2 Database │
│ (Shibboleth) │────│ (Port 8443) │────│ (In-Memory) │
│ (Port 443) │ │ │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
- Java 17 or higher
- Maven 3.6+
- Git
- Java 17 or higher
- Apache HTTP Server with mod_ssl and mod_shib
- Shibboleth Service Provider configured for UIC
- SSL Certificates (*.engr.uic.edu)
git clone <repository-url>
cd uic-shibboleth
# Using Maven wrapper (recommended)
./mvnw clean package
# Or using system Maven
mvn clean package
ls target/uic-shibboleth-*.jar
The application uses Spring Boot's configuration system with YAML files.
app:
auth:
login-url: /Shibboleth.sso/Login
logout-url: /Shibboleth.sso/Logout
auto-create-user: true
local-dev-mode: false
server:
port: 8443
ssl:
enabled: true
key-store: file:/etc/pki/tls/keystore.p12
key-store-password: password
key-store-type: PKCS12
key-alias: tomcat
error:
whitelabel:
enabled: false
spring:
config:
activate:
on-profile: local
app:
auth:
login-url: /login
logout-url: /logout
auto-create-user: true
local-dev-mode: true
server:
port: 8080
ssl:
enabled: false
Property | Description | Default |
---|---|---|
app.auth.auto-create-user |
Automatically create users from Shibboleth attributes | true |
app.auth.local-dev-mode |
Enable local development authentication | false |
server.port |
Application port | 8443 (prod), 8080 (dev) |
server.ssl.enabled |
Enable SSL/TLS | true (prod), false (dev) |
# Run with local profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=local
# Or set environment variable
export SPRING_PROFILES_ACTIVE=local
./mvnw spring-boot:run
Access: http://localhost:8080
# Run with default (production) profile
./mvnw spring-boot:run
# Or as JAR
java -jar target/uic-shibboleth-*.jar
Access: https://test.engr.uic.edu (through Apache proxy)
Purpose: Development and testing without Shibboleth infrastructure
Features:
- Mock user authentication with predefined test users
- Simple email/password login form
- Session-based authentication
- No external dependencies
Test Users:
Password | Role | Department | |
---|---|---|---|
john.dev@uic.edu | password | Faculty | Computer Science |
jane.test@uic.edu | password | Staff | Information Technology |
admin@uic.edu | password | Employee | Administration |
student@uic.edu | password | Student | Engineering |
Usage:
- Start application with
local
profile - Navigate to http://localhost:8080
- Click "Local Development Login"
- Use any test user email with password "password"
Purpose: Production authentication through UIC's Shibboleth IdP
Features:
- Integration with UIC's identity provider
- Automatic user attribute mapping
- Apache mod_shib integration
- SSL/TLS encryption
User Flow:
- User accesses https://test.engr.uic.edu
- Apache redirects to Shibboleth IdP
- User authenticates with UIC credentials
- Shibboleth returns user attributes as HTTP headers
- Spring Boot creates/updates user record
- User gains access to application
<VirtualHost *:443>
ServerName test.engr.uic.edu
# SSL Configuration
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/*.engr.uic.edu.crt
SSLCertificateKeyFile /etc/pki/tls/private/*.engr.uic.edu.key
SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt
# Shibboleth Handler
<Location /Shibboleth.sso>
SetHandler shib
</Location>
# Shibboleth Protection
<Location />
AuthType shibboleth
ShibRequestSetting requireSession true
ShibUseHeaders On
Require shib-session
Require valid-user
</Location>
# Proxy to Spring Boot
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire Off
# Logging
ErrorLog /var/log/httpd/shibboleth-spring-boot_error.log
CustomLog /var/log/httpd/shibboleth-spring-boot_access.log combined
</VirtualHost>
SetHandler shib
: Routes Shibboleth SSO requests to mod_shibShibUseHeaders On
: Exposes Shibboleth attributes as HTTP headersProxyPass
/ProxyPassReverse
: Forwards requests to Spring Boot applicationSSLProxyEngine On
: Enables SSL for backend communication
# Convert PEM certificates to PKCS12 format
openssl pkcs12 -export \
-in /etc/pki/tls/certs/*.engr.uic.edu.crt \
-inkey /etc/pki/tls/private/*.engr.uic.edu.key \
-out /etc/pki/tls/keystore.p12 \
-name tomcat \
-password pass:password
server:
ssl:
key-store: file:/etc/pki/tls/keystore.p12
key-store-password: password
key-store-type: PKCS12
key-alias: tomcat
Configuration:
spring:
datasource:
url: jdbc:h2:mem:testdb
driver-class-name: org.h2.Driver
username: sa
password: password
h2:
console:
enabled: true
path: /h2-console
Access H2 Console: http://localhost:8080/h2-console (dev mode)
CREATE TABLE users (
uid VARCHAR(255) PRIMARY KEY,
display_name VARCHAR(255),
given_name VARCHAR(255),
surname VARCHAR(255),
mail VARCHAR(255),
edu_person_principal_name VARCHAR(255),
edu_person_primary_affiliation VARCHAR(255),
edu_person_scoped_affiliation VARCHAR(255),
i_trust_suppress BOOLEAN,
organization_name VARCHAR(255),
i_trust_home_dept_code VARCHAR(255),
i_trust_uin VARCHAR(255),
organizational_unit VARCHAR(255),
title VARCHAR(255)
);
Method | Path | Description | Authentication |
---|---|---|---|
GET | / |
Home page | Public |
GET | /login |
Local login page | Public (dev mode) |
POST | /local-login |
Local authentication | Public (dev mode) |
POST | /local-logout |
Local logout | Public (dev mode) |
GET | /user |
User attributes page | Required |
GET | /error |
Error handler | Public |
Method | Path | Description | Response |
---|---|---|---|
GET | /api/user |
Get current user data | JSON user object |
{
"authenticated": true,
"user": {
"uid": "dev001",
"displayName": "John Developer",
"mail": "john.dev@uic.edu",
"givenName": "John",
"surname": "Developer",
"eduPersonPrimaryAffiliation": "faculty",
"organizationName": "University of Illinois Chicago"
// additional attributes...
}
}
- Import as Maven project
- Set Project SDK to Java 17
- Enable Spring Boot support
- Run configurations:
- Main class:
UicShibbolethApplication
- VM options:
-Dspring.profiles.active=local
- Main class:
- Install Java Extension Pack
- Install Spring Boot Extension Pack
- Open folder in VS Code
- Use Command Palette: "Java: Run Spring Boot App"
# Run all tests
./mvnw test
# Run with coverage
./mvnw test jacoco:report
# Enable Spring Boot DevTools
./mvnw spring-boot:run -Dspring-boot.run.profiles=local
./mvnw clean package -DskipTests
# create new dir
sudo mkdir -p /opt/uic-shibboleth
# copy the jar
sudo cp target/uic-shibboleth-0.0.1-SNAPSHOT.jar /opt/uic-shibboleth/uic-shibboleth.jar
# Create service file
sudo vim /etc/systemd/system/uic-shibboleth.service
[Unit]
Description=UIC Shibboleth Spring Boot Application
After=network.target
[Service]
Type=simple
User=uic-app
ExecStart=/usr/bin/java -jar /opt/uic-shibboleth/uic-shibboleth.jar
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable uic-shibboleth
sudo systemctl start uic-shibboleth
sudo systemctl status uic-shibboleth
# Copy virtual host configuration
sudo vim test.engr.uic.edu.conf # write your proxy configurations
sudo systemctl restart httpd
Symptoms: Cannot connect to HTTPS endpoints Solutions:
- Verify keystore path and password
- Check certificate validity
- Ensure proper file permissions
Symptoms: User creation fails, missing attributes Solutions:
- Check Apache logs:
/var/log/httpd/shibboleth-spring-boot_error.log
- Verify Shibboleth configuration
- Test attribute release with Shibboleth IdP
Symptoms: JPA/Hibernate errors Solutions:
- Check H2 console accessibility
- Verify datasource configuration
- Review application logs
Symptoms: Cannot login with test users Solutions:
- Ensure
local-dev-mode: true
- Use exact email addresses from test data
- Verify password is "password"
logging:
level:
org.springframework.security: INFO
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
file:
name: logs/uic-shibboleth.log