Wildcard Photos
The Wildcard Photos integration downloads a user’s Northwestern Wildcard ID card photo from the Directory Search API and stores it in S3. Photos are served to the application via time-limited presigned URLs.
This feature is disabled by default and can be enabled with a single environment variable.
How It Works
Section titled “How It Works”-
Photo sync triggered
During SSO login,
FindOrUpdateUserFromDirectoryconditionally dispatches aDownloadWildcardPhotoJobifWILDCARD_PHOTO_SYNC_ENABLEDis true. The job can run synchronously (during login) or asynchronously on the queue. -
LDAP photo retrieval
The job calls
DirectorySearch::lookupByNetId()with 3 retries and 100ms delay. ThejpegPhotoattribute in the LDAP response contains the base64-encoded photo. -
S3 storage
The decoded photo is written to
wildcard-photos/{netid}.jpgon thes3disk. The user record is updated with thewildcard_photo_s3_keyandwildcard_photo_last_synced_attimestamp. If no photo is found, the key is set tonull. -
Serving photos
WildcardPhotoControllergenerates a 30-minute presigned S3 URL and returns a redirect response. If no photo is stored, it falls back to a default profile image.
Authorization
Section titled “Authorization”The photo endpoint requires authentication and checks Gate::allows('view', $user) before returning the photo URL. This ensures users can only access photos they are authorized to see.
The response includes Cache-Control: private, max-age=1800 (30 minutes) to match the presigned URL lifetime.
Routes
Section titled “Routes”| Method | URI | Name | Notes |
|---|---|---|---|
GET | /users/{user}/wildcard-photo | users.wildcard-photo | Only registered when feature is enabled |
Enabling the Feature
Section titled “Enabling the Feature”WILDCARD_PHOTO_SYNC_ENABLED=trueWhen disabled, the photo route is not registered and the DownloadWildcardPhotoJob is not dispatched during login. The feature is completely inert.