This repository contains a Magento 2 module developed to demonstrate technical expertise during job interviews. The module showcases various aspects of Magento 2 module development, including custom helpers, plugins, observers, and SAML (Security Assertion Markup Language) integration.
The primary purpose of this module is to illustrate skills in:
- Developing Magento 2 modules
- Handling SAML2-based Single Sign-On (SSO)
- Customizing customer group assignments
The original single-sign-on module could map customers to customer groups based on configurations in the system settings. However, the SAML data from Toyota required additional parameters to map customers to the correct groups effectively.
Since this repository is tailored for simplicity, it only includes the contents of the ToyotaSsoProcessing
directory. Typically, this module would reside under app/code/Jvdh/ToyotaSsoProcessing
in a Magento 2 project.
-
Helper Classes
Helper/Data.php
: Contains reusable methods for SSO processing, such as customer group mapping and module configuration checks.
-
Observers
Observer/Saml2CustomerSuccessfullyUpdated.php
: Handles SAML2 events, such as updating customer-related data when an SSO process succeeds.
-
Plugins
Plugin/Controller/Saml2/ACS.php
: Extends the functionality of the ACS (Assertion Consumer Service) controller to assign customer groups based on SAML attributes.
The module relies on specific configurations and environment variables for seamless operation:
-
Environment Variables
Toyota_EMAIL_DOMAINS
: Comma-separated list of email domains for mapping customers to specific groups.Toyota_ADMIN_EMAILS
: Comma-separated list of admin email addresses for special handling.
-
Magento Admin Settings
- Navigate to
Stores > Configuration > Foobar > SAML2 Customer
to ensure the module is enabled for Toyota integration.
- Navigate to
- SAML2 Integration: Leverages SAML2 protocol for secure Single Sign-On.
- Dynamic Customer Group Assignment: Resolves and assigns customer groups based on predefined mappings and SAML attributes.
- Session and Quote Handling: Updates customer session and quote data to reflect group changes.
- Error Handling: Provides user-friendly error messages for missing or incorrect configurations.
- This module is a technical demonstration and not intended for production use.
- Ensure proper configurations and security practices when integrating SAML in live environments.
This project is licensed under the MIT License. Feel free to use and modify it as needed.
Developed by me.
For any questions or further discussions, please feel free to contact me via [your email or LinkedIn profile].