Author Topic: Pass parameters to autologon?  (Read 3560 times)

Offline geoB

  • Newbie
  • *
  • Posts: 8
Pass parameters to autologon?
« on: November 16, 2016, 04:32:46 PM »
If I read this forum post correctly, a single user's credentials are hard-coded in the autologon class.  Is it possible to pass user credentials to that class? Or is there another method for accomplishing what is in essence single sign-on?

Background: I've got an application using Symfony that requires authorization to access.  Its user database is configured to supply IMAP usernames & passwords to dovecot. It would be a nice feature to have logging into the Symfony application enable access to email inboxes without requiring an additional login. The Symfony app can map RoundCube classes so it's possible to call a Roundcube class within the Symfony user listener. But when I call
Code: [Select]
new autologon(); I get
Quote
Missing argument 1 for rcube_plugin

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: Pass parameters to autologon?
« Reply #1 on: November 16, 2016, 10:24:34 PM »
You can take the autologin plugin and modified to lookup info in the database.

Offline geoB

  • Newbie
  • *
  • Posts: 8
Re: Pass parameters to autologon?
« Reply #2 on: November 21, 2016, 09:18:03 AM »
Having the autologon plugin look up data in the database requires passing parameters to the plugin, which was my original question.  It is unfortunate that such a seemingly common feature of SSO requires deconstruction of code.  A "cookbook" article would be a great addition to the wiki. But out of my league for now.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: Pass parameters to autologon?
« Reply #3 on: November 21, 2016, 10:01:11 AM »
You can pass in anything you need by passing get variables, the autologon plugin runs when Roundcube starts so $_GET['id'] would get the id parameter from https://example.com/roundcube/?id=userfoo obviously for security you'd want to pass unique that changes and maybe match it to a cookie to make sure the right user is trying to login.

There isn't a "cookbook" style guide since every implementation will be very different, although some more documentation and examples would definitely be helpful.

Offline geoB

  • Newbie
  • *
  • Posts: 8
Re: Pass parameters to autologon?
« Reply #4 on: November 21, 2016, 06:34:56 PM »
Thanks for your reply.  I appreciate the wide variety of environments for Roundcube.  Your reply, though, provided a clue I had not seen before - that an id needed to be sent to a URL in a $_GET.  This I can do.  It will be necessary to make my listener add an id if it doesn't already exist, but that's easy.  Your guidance is appreciated.