Directory Search
The Directory Search integration looks up Northwestern users by NetID, email, or employee ID via the LDAP-backed Directory Search API. It is the primary mechanism for user provisioning during SSO login and for keeping user profile data synchronized with Northwestern’s identity system.
The underlying API client is provided by the northwestern-sysdev/laravel-soa package.
How It Works
Section titled “How It Works”-
Search type detection
DirectorySearchType::fromSearchValue()auto-detects whether the input is an email address, employee ID (numeric), or NetID (fallback). -
API lookup
The
DirectorySearchclass fromlaravel-soacalls Northwestern’s Directory Search API with abasicdetail level. -
Validation
The response is validated to ensure required fields are present —
eduPersonPrimaryAffiliationandmailmust exist for the entry to be considered valid. -
Field mapping
SyncUserFromDirectorymaps raw LDAP attributes onto the User model, handling multi-value arrays and student-specific field priority. -
Persistence
PersistUserWithUniqueUsernamesaves the user record and assigns the defaultNorthwestern Userrole.
Key Classes
Section titled “Key Classes”| Class | Purpose |
|---|---|
FindOrUpdateUserFromDirectory | Orchestrates the full lookup-validate-sync-persist flow |
SyncUserFromDirectory | Maps LDAP attributes to User model fields |
DirectorySearchType | Auto-detects search input type (email, employee ID, NetID) |
PersistUserWithUniqueUsername | Saves/updates user with unique username generation |
Invalid Directory Data
Section titled “Invalid Directory Data”When a directory lookup returns invalid data (missing required fields), the behavior depends on whether the user already exists:
- Existing user — The account is marked with
netid_inactive = trueanddirectory_sync_last_failed_atis recorded. The user is not deleted. - New user — A
BadDirectoryEntryexception is thrown, preventing account creation with incomplete data.
This ensures that transient directory issues don’t destroy existing accounts while still preventing invalid new accounts.
Health Check
Section titled “Health Check”The DirectorySearchCheck class provides a Spatie Health check for the Directory Search API. It performs a test lookup against a configured NetID and validates the response structure.
Configuration
Section titled “Configuration”DIRECTORY_SEARCH_URL=https://northwestern-prod.apigee.net/directory-searchDIRECTORY_SEARCH_API_KEY=your-api-keyDIRECTORY_SEARCH_HEALTH_CHECK_NETID=swd2981| Variable | Default | Description |
|---|---|---|
DIRECTORY_SEARCH_URL | https://northwestern-prod.apigee.net/directory-search | Directory Search API base URL |
DIRECTORY_SEARCH_API_KEY | — | Apigee API key for Directory Search |
DIRECTORY_SEARCH_HEALTH_CHECK_NETID | swd2981 | NetID used for health check lookups |