Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Custom Authentication Process

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 2077 Views
  • MKayHavoc
    Avatar
    Community Member
    33 Posts

    Custom Authentication Process Link to this post

    Hi,

    I'm using the PEAR Auth package to authenticate against LDAP and tie down my entire site, make it authentication only.

    I've added the code into Page_Controller function init() and it's working and I can authenticate. However once authenticated I end up at sapphire/main.php instead of the page I was trying to visit. How can I make this work properly?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts
  • MKayHavoc
    Avatar
    Community Member
    33 Posts

    Re: Custom Authentication Process Link to this post

    I'm already using the LDAP extension for the CMS. What I'm wanting to do is lock down the entire site. Requiring authentication to view it.

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: Custom Authentication Process Link to this post

    Ah, in the controller for Page, you'll need to add a line that checks for the view permission

    eg:

    function init() {
    if(!Permission::check("VIEW_SITE")) Security::permissionFailure();
    }

    However, you'll need to make sure that users can use the login page! Eg, check to make sure the user is not trying to access the security login page - if not, apply the code above.

    This will make sure that the user must be logged in to view any page except the login page.

  • MKayHavoc
    Avatar
    Community Member
    33 Posts

    Re: Custom Authentication Process Link to this post

    That bit of code gives me a Redirect Loop error.

    Basically all i'm trying to do is add in a bit of Authentication code that is run on each page load to make sure a session is present. The code runs and I can authenticate but it then redirects me to /sapphire/main.php instead of the page I was trying to go to before authenticating.

    The code is using the Auth PEAR package and my own custom login form.

    I'm just trying to figure out why it's not remembering what page I was trying to get to and sending me to main.php...?

    2077 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.