Lecture 11 - Authentication and Associations.pdf

40 views2 pages
21 Oct 2013
School
Professor
CS169: Software Engineering
October 9, 2013
Announcements
Midterm:
everything through TDD
1 sheet both sides cheat sheet (typed or handwritten)
there are questions that will build off the homework (up to homework 2)
practice questions are posted
1.5 hour test in 3 hour window
reference docs will be given
regex reference may be useful for the cheat sheet though
Aspect-Oriented Programming
advice: specific piece of code that implements cross-cutting concern
aspect = advice + pointcut
these will help DRY out your code
validation is the advice
models come with “errors” attribute
lifecycle callbacks
allow pre/post operations with predetermined pointcuts
good for operations to standardize data (i.e. cast everything or toUppercase)
control filters
filters declared in controller go to subclass
can alter the flow of execution with “redirect_to” or “render
make sure you alert the user (like “must be logged in to view this page”) or else a
silent failure may confuse them
anything you can code, you can validate
CON: code is harder to debug with all these pointcuts and redirects!
Quiz: Which Ruby features support this DRYness?
A: higher-order functions
B: closures
C: metaprogramming
Answer: All three! (mostly C though)
Single Sign-On and Third Party Authentication
you don’t want to rely on log in info
tamper-evident secure token to keep everything secure
use a string that will be invalid if views
just a “handle”, it doesn’t actually have important information in it
1. Log in with Twitter, 2. Redirect to Twitter, 3. Ok to authorize this app? 4. redirect back
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.