[ZendTo] Use different AD attribute

Michael Koza michael.koza at utoronto.ca
Wed Mar 8 18:41:02 GMT 2017


Hi Jules,

Thanks for the response. This is just a quick follow-up to this for anyone wishing to do the same. There's actually a quite elegant solution tucked away here because of the design of the application (thanks again Jules).

If you create a new Authenticator that extends the NSSADAuthenticator you can accomplish this rather easily. See a rough example below.

Then you just change the authenticator from "AD" to "MyCustomAD" in your preferences file.

<?php
require_once('NSSADAuthenticator.php');

class NSSMyCustomADAuthenticator extends NSSADAuthenticator
{
public function Tryvalid($uname, &$response)
      {
            $result = parent::Tryvalid($uname, $response);
            //Do your change to $response array items
            //ex. $response['mail'] = $response['someOtherAttribute'];
            return $result;
      }

      public function Tryauthenticate($uname, $password, &$response)
      {
            $result = parent::Tryauthenticate($uname, $password, $response);
            // Do the change as above
            return $result;
      }
}

Cheers,

Mike Koza
Drupal Developer, I&ITS Web Technology Services
University of Toronto Mississauga
Service Desk: (905) 828 5344

From: zendto-bounces at zend.to [mailto:zendto-bounces at zend.to] On Behalf Of Jules
Sent: Friday, February 03, 2017 10:44 AM
To: ZendTo Users
Subject: Re: [ZendTo] Use different AD attribute

Brian,

The simplest way for you to do this is probably a minor tweak to the code for the AD authenticator.
This is in the file
    /opt/zendto/lib/NSSADAuthenticator.php

If you edit that file, you should find *2* occurrences of a line that says this:
              $response['organization'] = $this->_ldapOrg;

In both places, you could just add a line immediately below it that overwrites the 'mail' attribute's value with whatever attribute's value you want to use instead. So for example, if you wanted to use the 'electronicmail' attribute instead, the extra line in both cases would be
              $response['mail'] = $response['electronicmail'];

However, do bear in mind that your change will be overwritten when you upgrade the rpm/deb of the ZendTo package, so you would need to add that to your service documentation.

Cheers,
Jules.

On 03/02/2017 12:59, Brian Novogradac wrote:
Hello all,

Is there anyway to use different AD attributes to pull information that is displayed in the zendto app.  I am looking primarily at the mail attribute.  I would like to change that attribute to pull info from another.



Brian Novogradac
Intermediate Systems Administrator (I&ITS)



Information Security Is Everyone's Responsibility. Learn more: http://uoft.me/cyberaware

University of Toronto at Mississauga
3359 Mississauga Road N.
Mississauga, Ontario, L5L 1C6

(P) 416-435-2543
(F) 905-569-4343
(E) brian.novogradac at utoronto.ca<mailto:brian.novogradac at utoronto.ca>
(W) www.utm.utoronto.ca/iits<http://www.utm.utoronto.ca/iits>

This E-mail contains privileged and confidential information intended only for the individual or entity named in the message. If the reader of this message is not the intended recipient, or the agent responsible to deliver it to the intended recipient, you are hereby notified that any review, dissemination, distribution or copying of this communication is prohibited.  If this communication was received in error, please notify the sender by reply E-mail immediately, and delete and destroy the original message.





_______________________________________________

ZendTo mailing list

ZendTo at zend.to<mailto:ZendTo at zend.to>

http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto



Jules



--

Julian Field MEng MBCS CITP CEng





www.Zend.To<http://www.Zend.To>

Twitter: @JulesFM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20170308/a6aafef2/attachment.html 


More information about the ZendTo mailing list