# Extensions and authentication

**URL:** <https://www.ruby-forum.com/t/extensions-and-authentication/81337>\
**Category:** Radiant CMS\
**Created:** [January 8, 2007, 12:37am UTC](https://www.ruby-forum.com/t/extensions-and-authentication/81337 "2007-01-08T00:37:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [January 8, 2007, 12:37am UTC](https://www.ruby-forum.com/t/extensions-and-authentication/81337/1 "2007-01-08T00:37:27Z")

</div>

I’m missing something obvious about extensions and authentication  
requirements?

Background  
I setup an extension hoping to be able to process forms from the  
_public_ side  
of the site.

- using Mental Branch

- run ruby script\generate extension mailertest

- update mailertest\_extension.rb:

- in mailertest controller add method to make sure the new controller is  
used:

- access [http://localhost:3000/mailertest](http://localhost:3000/mailertest)  
where I’m promptly redirected to the /admin/ login screen.

log:  
Redirected to [http://localhost:3000/admin/login](http://localhost:3000/admin/login)  
Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::SymbolFilter:0x950b85c  
@filter=:authenticate\>] returned false.  
Filter chain halted as [:authenticate] did not yield.

–/–  
I’m missing something obvious aren’t I? Is there a way to specify that  
an  
extension shouldn’t require authentication?

Actually, maybe I’m on the wrong track all together - I want to be able  
to  
process forms submitted from the public side of the site. I don’t need  
any  
tags that will create the forms and inputs. Perhaps, easier if I add a  
route  
in routes.rb to /mailertest and put the controller alongside Radiant  
code?

Any insight appreciated!

Todd M

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [January 8, 2007, 3:05am UTC](https://www.ruby-forum.com/t/extensions-and-authentication/81337/2 "2007-01-08T03:05:37Z")

</div>

Hey Todd,

Add “no\_login\_required” after the class declaration.

Your buddy,  
Todd

Quoting Todd McGrath [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [January 9, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/extensions-and-authentication/81337/3 "2007-01-09T21:15:37Z")

</div>

Todd,

Thanks for this, I had already given-up on the possibility of an  
extension doing anything other than packaging-up an admin interface  
for functionality which would have to happen through Radius tags. As  
it is this is much more powerful, especially if I can figure-out how  
to flow the output of my views into a Radiant layout.

However, when I apply the technique you describe I still get sent to  
the login screen. What am I doing wrong in-order to bypass the admin  
login requirement. Here is my Radiant::Extension class declaration  
including the “no\_login\_required” flag:

class StaffListingExtension \< Radiant::Extension  
version “1.0”  
description “An extension for a staff listing”  
url “[http://fn-group.com](http://fn-group.com)”

no\_login\_required

define\_routes do |map|  
# map.connect ‘admin/staff\_listing/:action’, :controller =\> ‘staff’  
map.connect ‘directory/:action’, :controller =\> ‘staff’  
end

def activate  
# admin.tabs.add “Staff Listing”, “/admin/staff\_listing”, :after  
=\> “Layouts”, :visibility =\> [:all]  
end

def deactivate  
# admin.tabs.remove “Staff Listing”  
end

end

?

Thanks,

Loren J.

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [January 9, 2007, 9:35pm UTC](https://www.ruby-forum.com/t/extensions-and-authentication/81337/4 "2007-01-09T21:35:45Z")

</div>

Hi Loren,

Looking back, I wasn’t very clear. I was too busy laughing for sending  
an email  
to myself. Should have said “add it to your controller”; i.e.

class TellafriendController \< ApplicationController

no\_login\_required

def sendafriend  
render :update do |page|  
page.replace\_html(“target”, “Mail sent”)  
page[:target].visual\_effect :highlight,  
:startcolor =\> “#88ff88”,  
:endcolor =\> “#114411”  
end  
end

end

As you can see, I just want to be able to respond to AJAX requests.

Based on your post, you need to add “no\_login\_required” to your  
directory  
controller.

Hope this helps and please post back to the list your experiences with  
view  
output.

Todd McGrath

Quoting Loren J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
