I am coming from a wonderful merb experience where i actually got a
working app handling several file uploads. I am the happiest guy in
the world. But I I haven't understand exactly how to handle user
authentication.
Situation is this: I got APP A (rails app working flawlessly and doing
all user autentication, authorization and handling user payments) then
i got APP B (MERB app handling the file uploads).
I am using restful_authentication in APP A and i'd like to redirect to
APP B and having my users authenticate b4 start uploading the files. I
am actually using the same db (mysql) for both apps and it works fine.
Now, I'd basically need a very simple basic authentication form on my
MERB APP to let user log in with their LOGIN and EMAIL. Now, I've
messed a whole afternoon trying to understand exactly if i'd really
need to use the merb-auth-password slice, with the conclusion that it
handles basic login with LOGIN and PASSWORD. Tryied then to roll my
own strategy and commented out the salted user part in setup.rb since
i do not really need to let my user authenticate with a password.
Result is that it just pops a Unknown property 'authenticate!' for my
strategy.rb
class MyStrategy < Merb::Authentication::Strategy
def run!
login = request.params[:login]
email = request.params[:email]
User.authenticate!(login, email) if login
end
end
And in my setup.rb i got
Merb::Plugins.config[:"merb-auth"][:login_param] = :login
Merb::Plugins.config[:"merb-auth"][:password_param] = :email
begin
# Sets the default class ofr authentication. This is primarily used
for
# Plugins and the default strategies
Merb::Authentication.user_class = User
# Mixin the salted user mixin
# require 'merb-auth-more/mixins/salted_user'
# Merb::Authentication.user_class.class_eval{ include
Merb::Authentication::Mixins::SaltedUser }
# Setup the session serialization
class Merb::Authentication
def fetch_user(session_user_id)
Merb::Authentication.user_class.get(session_user_id)
end
def store_user(user)
user.nil? ? user : user.id
end
end
rescue
Merb.logger.error <<-TEXT
You need to setup some kind of user class with merb-auth.
Merb::Authentication.user_class = User
If you want to fully customize your authentication you should use
merb-core directly.
See merb/merb-auth/setup.rb and strategies.rb to customize your
setup
TEXT
end
in my strategies.rb
Merb::Slices::config[:"merb-auth-slice-password"]
[:no_default_strategies] = false
Merb::Authentication.activate!(:default_password_form)
Merb::Authentication.activate!(:default_basic_auth)
Then I thought I could only use merb-auth-core so i got rid of
unwanted dependencies and I am stuck in trying to understand how to
implement a basic form in my unauthenticated.html.erb view and how to
handle the logic.
Basically I am asking myself where do i need to implement that logic?
Any feedback on this would be highly appreciated. Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---