Mixing troubles

Hello all. I’m having some trouble trying to wrap my brain around an
issue I’m having with an authentication engine I’m developing. I’m
trying to separate out my User model’s functionality into a module so
that I can customize the user model in each rails application without
directly modifying the engine source. I’ve been using the LoginEngine
as a blueprint for how to do this.

The problem is that I can’t seem to set my class methods to being
protected or they won’t be accessible from my instance methods. When I
call change_password on a user it throws an error that try_credentials
is protected. I’ve trimmed down the code to the parts that I think are
relevant. Anyone know why this doesn’t work, or if there is a different
way this should be done?

module AuthenticationEngine
module AuthUser
def self.included(base)
base.class_eval {
# attr, validation stuff, etc.
}
base.extend(ClassMethods)
end
end

module ClassMethods
protected
def try_credentials(login_name, password)
# try login
end

public
  # these work ok

end

instance methods

def change_password(current, changed)
acct = self.class.try_credentials(read_attribute(‘login_name’),
current)
# do other stuff
end
end

class User < ActiveRecord::Base
include AuthenticationEngine::AuthUser
end