Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
displayname #2
  • Loading branch information
rzmf committed Dec 23, 2016
commit 1c548f2fd57c9c615680e2321e594760a26a9503
21 changes: 20 additions & 1 deletion lib/Controller/SAMLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public function __construct($appName,
*/
private function autoprovisionIfPossible(array $auth) {
$uidMapping = $this->config->getAppValue('user_saml', 'general-uid_mapping');
$displayName = $auth['urn:oid:2.5.4.42'][0] . ' ' . $auth['urn:oid:1.2.40.0.10.2.1.1.261.20'][0];
$displaynamefirstpartMapping = $this->config->getAppValue('user_saml','general-displaynamefirstpart_mapping');
$displaynamesecondpartMapping = $this->config->getAppValue('user_saml','general-displaynamesecondpart_mapping');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would prefer to not separate between first name and second name here. Rather just a single input field that can take multiple fields. (such as {{fieldBar}} {{fieldFoo}})

If you can give me commit access to your fork I can try to come up with something like that later.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave you commit Access (i hope...)

Copy link
Member

@LukasReschke LukasReschke Jan 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I just finished the automated integration test suite for Shibboleth. I'll see if I can find some time to dig into this here. :) – But I'm pretty busy at the moment with a lot of other stuff…

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw: already got mailadress working, not ready for commit yet....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update on this mailaddress item? I am storing the mail address(preferences database, as email configkey for given uid, like LDAP is doing this too), but it is not shown in the users personal page. Also, i have configured the displayname and its shown in the upper right side of the WebUI, but also not on the personal page. Somewhat strange.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Displayname works for me everywhere: upper right side, personal page, search field for sharing items.

regarding mailaddress: i have not found time to implement this better.

My current solution is: writing the email the moment the user gets created, no update, no changes:

SAMLController.php

$mailMapping = "urn:oid:0.9.2342.19200300.100.1.3";

                $mail='';
                if(isset($auth[$mailMapping])) {
                        if(is_array($auth[$mailMapping])) {
                                $mail = $auth[$mailMapping][0];
                        } else {
                                $mail = $auth[$mailMapping];
                        }
                }`

if(!$userExists && !$autoProvisioningAllowed) {
                                throw new NoUserFoundException();
                        } elseif(!$userExists && $autoProvisioningAllowed) {
                                $this->userBackend->createUserIfNotExists($uid,$displayName);
                                $user = $this->userManager->get($uid);
                                error_log("set email");
                                if (!is_null($user)) {
                                        $user->setEMailAddress($mail);
                                }
                                error_log("set email");
                                return;
                        }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your response!


if(isset($auth[$uidMapping])) {
if(is_array($auth[$uidMapping])) {
Expand All @@ -94,6 +95,24 @@ private function autoprovisionIfPossible(array $auth) {
$uid = $auth[$uidMapping];
}

$displayName='';
if(isset($auth[$displaynamefirstpartMapping])) {
if(is_array($auth[$displaynamefirstpartMapping])) {
$displayName = $auth[$displaynamefirstpartMapping][0];
} else {
$displayName = $auth[$displaynamefirstpartMapping];
}
}

if(isset($auth[$displaynamesecondpartMapping])) {
if(is_array($auth[$displaynamesecondpartMapping])) {
$displayName .= " " . $auth[$displaynamesecondpartMapping][0];
} else {
$displayName .= " " . $auth[$displaynamesecondpartMapping];
}
}


$userExists = $this->userManager->userExists($uid);
if($userExists === true) {
return;
Expand Down
10 changes: 10 additions & 0 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public function getForm() {
'type' => 'line',
'required' => true,
],
'displaynamefirstpart_mapping' => [
'text' => $this->l10n->t('Attribute to map the first part of the displayname (eg given name)'),
'type' => 'line',
'required' => false,
],
'displaynamesecondpart_mapping' => [
'text' => $this->l10n->t('Attribute to map the second part of the displayname (eg last name).'),
'type' => 'line',
'required' => false,
],
'require_provisioned_account' => [
'text' => $this->l10n->t('Only allow authentication if an account is existent on some other backend. (e.g. LDAP)'),
'type' => 'checkbox',
Expand Down