🚧 Status: In Development - Preparation Phase Complete
This HumHub module enables authentication via Moodle OAuth 2.0, allowing users to log in to HumHub using their Moodle credentials.
This module has been forked from auth-google and all code has been prepared for Moodle OAuth integration. The structural changes are complete, but the module requires configuration and testing before it can be used.
- All namespaces migrated from Google to Moodle
- OAuth client implementation structure created
- Configuration forms and admin interface adapted
- Comprehensive documentation created
- TODO comments added throughout code
- OAuth endpoint URLs (currently placeholders)
- User attribute mappings (need verification with real Moodle API)
- Translation files (keys defined, files not created)
- OAuth authentication flow
- User registration
- User login
- Error handling
- HumHub 1.18 or higher
- PHP 7.4 or higher with
allow_url_fopenenabled - Access to a Moodle instance with OAuth 2.0 configured
- Clone this repository into your HumHub modules directory
- Enable the module in HumHub admin interface
- Configure OAuth credentials in module settings
-
Read the documentation in the
docs/directory:docs/MIGRATION_SUMMARY.md- Overview of changes madedocs/IMPLEMENTATION.md- Technical detailsdocs/TODO.md- Complete task checklistdocs/TESTING.md- Testing guide
-
Configure OAuth endpoints in
authclient/MoodleAuth.php:- Update
$authUrl,$tokenUrl,$apiBaseUrlwith your Moodle URLs - See TODO comments in the file
- Update
-
Test with a Moodle instance:
- Follow the testing guide in
docs/TESTING.md - Verify user attribute mappings
- Test authentication flow
- Follow the testing guide in
-
Complete remaining tasks:
- Create translation files
- Update documentation with verified configuration
- Remove TODO comments as tasks are completed
- README.md - User-facing setup and configuration guide
- MIGRATION_SUMMARY.md - Overview of changes from auth-google
- IMPLEMENTATION.md - Technical implementation details
- TODO.md - Complete task checklist
- TESTING.md - Comprehensive testing guide
- CHANGELOG.md - Version history
Module ID: auth-moodle
Namespace: humhubContrib\auth\moodle
Version: 0.1.0 (Development)
HumHub Version: 1.18+
PHP Version: 7.4+
auth-moodle/
├── authclient/
│ └── MoodleAuth.php # OAuth client (needs endpoint configuration)
├── controllers/
│ └── AdminController.php # Admin interface controller
├── models/
│ └── ConfigureForm.php # Configuration model
├── views/
│ └── admin/
│ └── index.php # Admin configuration view
├── docs/
│ ├── README.md # User documentation
│ ├── CHANGELOG.md # Version history
│ ├── TESTING.md # Testing guide
│ ├── IMPLEMENTATION.md # Technical details
│ ├── TODO.md # Task checklist
│ └── MIGRATION_SUMMARY.md # Migration overview
├── config.php # Module configuration
├── Events.php # Event handlers
├── Module.php # Main module class
└── module.json # Module metadata
The module requires the following configuration:
-
Moodle OAuth Credentials:
- Client ID
- Client Secret
- Configured in HumHub admin interface
-
Moodle OAuth Endpoints (in code):
- Authorization URL
- Token URL
- User Info API URL
- Currently set as placeholders in
authclient/MoodleAuth.php
-
Redirect URI:
- Displayed in HumHub module settings
- Must be added to Moodle OAuth configuration
See docs/TODO.md for the complete checklist. Most critical items:
- Update OAuth endpoint URLs in
authclient/MoodleAuth.php - Verify user attribute mapping with actual Moodle API response
- Test authentication flow with real Moodle instance
- Create translation files for AuthMoodleModule
- Update documentation with verified configuration
Extensive TODO comments have been added throughout the code to guide development:
authclient/MoodleAuth.php- OAuth implementation TODOsmodels/ConfigureForm.php- Configuration TODOsviews/admin/index.php- UI TODOsdocs/README.md- Documentation TODOs
All UI strings use the AuthMoodleModule.base translation domain. Translation files need to be created in a messages/ directory following HumHub conventions.
Before this module can be used in production, it must pass all tests in docs/TESTING.md, including:
- Module installation and configuration
- OAuth authentication flow (new user registration)
- OAuth authentication flow (existing user login)
- Error handling
- Security testing
- User attribute mapping verification
This is a work in progress. Contributions are welcome!
When reporting issues, please include:
- HumHub version
- Moodle version
- PHP version
- Exact error messages
- Steps to reproduce
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
See docs/LICENCE.md for license information.
This module was forked from humhub-contrib/auth-google and adapted for Moodle OAuth authentication.
Ready to continue development? Start with docs/MIGRATION_SUMMARY.md to understand what has been done, then follow the checklist in docs/TODO.md.