Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update URN to the latest format defined at the [RFC] (https://tools.ietf.org/html/rfc6338) #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Important for enrollment!!
==========================

This plugin suppose that the IdP send the courses data of the user in a attribute that can be configured but the pattern of the expected data is defined per the [RFC](https://tools.ietf.org/html/rfc6338)
urn:mace:terena.org:schac:userStatus:<country>:<domain>:<course_id>:<period>:<role>:<status>
urn:schac:userStatus:<country>:<domain>:<course_id>:<period>:<role>:<status>
You can change this pattern editing the saml_hook_get_course_info method from the custom_hook.php file.
4 changes: 2 additions & 2 deletions custom_hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function saml_hook_attribute_filter(&$saml_attributes) {
if(isset($saml_attributes['schacPersonalUniqueID'])) {
foreach($saml_attributes['schacPersonalUniqueID'] as $key => $value) {
$data = [];
if(preg_match('/urn:mace:terena.org:schac:personalUniqueID:es:(.*):(.*)/', $value, $data)) {
if(preg_match('/urn:schac:personalUniqueID:es:(.*):(.*)/', $value, $data)) {
$saml_attributes['schacPersonalUniqueID'][$key] = $data[2];
//DNI sin letra
//$saml_attributes['schacPersonalUniqueID'][$key] = substr($value[2], 0, 8);
Expand Down Expand Up @@ -187,7 +187,7 @@ function saml_hook_post_user_created($user, $saml_attributes = []) {
function saml_hook_get_course_info($course) {
$regs = null;

$regex = '/urn:mace:terena.org:schac:userStatus:(.+):(.+):(.+):(.+):(.+):(.+)/';
$regex = '/urn:schac:userStatus:(.+):(.+):(.+):(.+):(.+):(.+)/';

if (preg_match($regex, $course, $matches)) {
$regs = $matches;
Expand Down