Test Your Knowledge
Quiz
Where is user and password information stored?
Where do you need to
include AuthenticatedSystemto make authentication available?How you tell a controller that users must be logged in to use that controller?
Where do you modify the rules that authorize users to have certain privileges?
How do you keep the logs from storing potentially sensitive security-related information?
Answers
User and password information is stored in the database, in a model you name when you first generate the authentication mechanisms.
You could put
include AuthenticatedSystemin each of your controllers, but it’s no doubt easiest to put it into theApplicationControllerclass in app/controllers/application.rb.The
before_filter :login_requiredmethod will block requests by unauthenticated users.You can redefine the
authorized?method in theApplicationControllerclass in app/controllers/application.rb.You can keep sensitive information out of the logs with
filter_parameter_logging.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access