Overriding ApplicationController method find_current_user
Added by Jean-François Doyon almost 15 years ago
Hello,
Redmine/Rails/Ruby newbie here, but experienced Python developer. I'm trying to write a custom authentication plugin.
I'm trying to modify find_current_user in ApplicationController to have it look at REMOTE_USER, to support web server level authentication ... but am not having any luck (inspired by what I read here: http://www.redmine.org/boards/1/topics/1047)
Any time I require or require_depency for 'application', I get an error message regarding the missing secret.
I suspect this is because the session isn't setup yet at that point?
I'm told overriding an existing class method can be done by simply redefining the class with the new method, is that right?
I've also seen use of the .send() method as per the plugins internals page, though I'm not yet clear on that method, gotta go read up on that ... I'd rather just redefine the method, since the plugin will be for our internal uses only.
Would anyone be nice enough to point me in the right direction?
Installation details:
About your application's environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rails version 2.1.2
Active Record version 2.1.2
Action Pack version 2.1.2
Active Resource version 2.1.2
Action Mailer version 2.1.2
Active Support version 2.1.2
Thanks!
Replies (5)
RE: Overriding ApplicationController method find_current_user
-
Added by Jean-François Doyon almost 15 years ago
Alternatively ... I just found the auth_source* stuff, which seems more appropriate, but ldap is hardcoded in there, maybe I can change that ...
Are there any alternate redmine authentication plugins out there I might be able to use for inspiration?
RE: Overriding ApplicationController method find_current_user
-
Added by Akiko Takano about 14 years ago
Hello.
I'm just planning the same thing, such as customize authentication with plugin.
Have you found any workaround?
RE: Overriding ApplicationController method find_current_user
-
Added by Arnaud Martel about 14 years ago
Maybe, you can use this plugin: http://github.com/AdamLantos/redmine_http_auth
If it doesn't provide exactly what you want, you can look at the source code to see how to implement REDMINE authentication based on REMOTE_USER or another authentication method...
RE: Overriding ApplicationController method find_current_user
-
Added by Akiko Takano about 14 years ago
Thank you so much your help!
I've customize Web Server's REMOTE_USER header and so on with mod_perl in front of Redmine.
After applying and testing this plugin, I'll report the result again.
Cheers,
RE: Overriding ApplicationController method find_current_user
-
Added by Akiko Takano about 14 years ago
I've reported about the redmine_http_auth plugin.
I think this is quite useful (for me), because this plugin can use not only REMOTE_USER but also other REQUEST Env values.
And this pluguin supports both http authentication and Redmine's native authentication.
(It has better for me if we both Redmine's session & HTTP Remote user auth, Redmine's session takes priority over http auth.)
Anyway, thanks again!