|
| 1 | +# Avatar System |
| 2 | + |
| 3 | +Poweradmin v4.0.0+ supports user avatars from OAuth providers and Gravatar. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The avatar system displays user profile pictures in the interface. Avatars can be sourced from: |
| 8 | + |
| 9 | +- **OAuth providers**: Profile pictures from OIDC/SAML identity providers |
| 10 | +- **Gravatar**: Global avatar service based on email address |
| 11 | + |
| 12 | +## Configuration |
| 13 | + |
| 14 | +| Setting | Default | Description | |
| 15 | +|---------|---------|-------------| |
| 16 | +| `interface.avatar_oauth_enabled` | true | Enable avatars from OAuth providers | |
| 17 | +| `interface.avatar_gravatar_enabled` | true | Enable Gravatar integration | |
| 18 | +| `interface.avatar_priority` | oauth | Priority: oauth or gravatar | |
| 19 | +| `interface.avatar_size` | 40 | Avatar size in pixels | |
| 20 | +| `interface.avatar_cache_ttl` | 3600 | Cache TTL in seconds | |
| 21 | + |
| 22 | +## Modern Configuration |
| 23 | + |
| 24 | +```php |
| 25 | +return [ |
| 26 | + 'interface' => [ |
| 27 | + 'avatar_oauth_enabled' => true, |
| 28 | + 'avatar_gravatar_enabled' => true, |
| 29 | + 'avatar_priority' => 'oauth', // 'oauth' or 'gravatar' |
| 30 | + 'avatar_size' => 40, |
| 31 | + 'avatar_cache_ttl' => 3600, // 1 hour |
| 32 | + ], |
| 33 | +]; |
| 34 | +``` |
| 35 | + |
| 36 | +## Docker Configuration |
| 37 | + |
| 38 | +```yaml |
| 39 | +environment: |
| 40 | + PA_AVATAR_OAUTH_ENABLED: "true" |
| 41 | + PA_AVATAR_GRAVATAR_ENABLED: "true" |
| 42 | + PA_AVATAR_PRIORITY: "oauth" |
| 43 | + PA_AVATAR_SIZE: "40" |
| 44 | + PA_AVATAR_CACHE_TTL: "3600" |
| 45 | +``` |
| 46 | +
|
| 47 | +## Avatar Priority |
| 48 | +
|
| 49 | +The `avatar_priority` setting determines which source is checked first: |
| 50 | + |
| 51 | +- **oauth**: Check OAuth provider first, fall back to Gravatar |
| 52 | +- **gravatar**: Check Gravatar first, fall back to OAuth |
| 53 | + |
| 54 | +If the primary source has no avatar, the secondary source is used. |
| 55 | + |
| 56 | +## OAuth Avatars |
| 57 | + |
| 58 | +OAuth avatars are retrieved from identity providers during login: |
| 59 | + |
| 60 | +- Azure AD, Google, Keycloak, etc. provide profile pictures |
| 61 | +- The `picture` claim is mapped automatically |
| 62 | +- Avatars are cached locally to reduce provider requests |
| 63 | + |
| 64 | +### OIDC Configuration |
| 65 | + |
| 66 | +Ensure user mapping includes the avatar claim: |
| 67 | + |
| 68 | +```php |
| 69 | +'user_mapping' => [ |
| 70 | + 'avatar' => 'picture', |
| 71 | + // ... other mappings |
| 72 | +], |
| 73 | +``` |
| 74 | + |
| 75 | +## Gravatar Integration |
| 76 | + |
| 77 | +Gravatar avatars are based on the user's email address: |
| 78 | + |
| 79 | +1. Email is hashed using MD5 |
| 80 | +2. Avatar is fetched from `gravatar.com` |
| 81 | +3. Default avatar shown if no Gravatar exists |
| 82 | + |
| 83 | +Users can set their Gravatar at [gravatar.com](https://gravatar.com). |
| 84 | + |
| 85 | +### Gravatar Defaults |
| 86 | + |
| 87 | +If a user has no Gravatar, a default image is displayed. Gravatar provides several default styles: |
| 88 | + |
| 89 | +- `mp` - Mystery person silhouette |
| 90 | +- `identicon` - Geometric pattern |
| 91 | +- `monsterid` - Monster avatar |
| 92 | +- `wavatar` - Face avatar |
| 93 | +- `retro` - 8-bit style |
| 94 | + |
| 95 | +## Caching |
| 96 | + |
| 97 | +Avatars are cached to improve performance: |
| 98 | + |
| 99 | +- **Cache TTL**: Default 1 hour (3600 seconds) |
| 100 | +- **Cache key**: Based on user ID and source |
| 101 | +- **Cache invalidation**: Automatic on logout |
| 102 | + |
| 103 | +Adjust `avatar_cache_ttl` based on your needs: |
| 104 | +- Lower values: More frequent updates, more requests |
| 105 | +- Higher values: Better performance, stale avatars |
| 106 | + |
| 107 | +## Disabling Avatars |
| 108 | + |
| 109 | +To disable avatars completely: |
| 110 | + |
| 111 | +```php |
| 112 | +'interface' => [ |
| 113 | + 'avatar_oauth_enabled' => false, |
| 114 | + 'avatar_gravatar_enabled' => false, |
| 115 | +], |
| 116 | +``` |
| 117 | + |
| 118 | +## Privacy Considerations |
| 119 | + |
| 120 | +1. **Gravatar**: Sends hashed email to external service |
| 121 | +2. **OAuth**: Avatar URLs may be stored in session |
| 122 | +3. **Caching**: Avatars may be cached on server |
| 123 | + |
| 124 | +For privacy-conscious deployments, consider disabling Gravatar and relying only on OAuth avatars (which users explicitly provide to their identity provider). |
| 125 | + |
| 126 | +## Related Documentation |
| 127 | + |
| 128 | +- [OIDC Authentication](oidc.md) |
| 129 | +- [SAML Authentication](saml.md) |
| 130 | +- [UI Customization](ui/overview.md) |
0 commit comments