SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
The Last Authentication
                 System You Will Ever Write


                         Jason Austin - @jason_austin - jfaustin@gmail.com




Thursday, May 26, 2011
A Quick Rundown

                    • Authentication Basics
                    • Pros/Cons of offloading
                    • Authentication Mechanisms
                    • Authentication Providers
                    • Implementation

Thursday, May 26, 2011
Authentication Basics
                         Authentication
                              !=
                         Authorization


                                          flickr - @digiart2001


                 Who you are
                       vs.
              what rights you have


Thursday, May 26, 2011
Setting Up An Auth
                               System
                    • Signup
                    • Confirmation
                    • Authenticate (Username / Password)
                    • Password Retrieval / Reset
                    • Password Change

Thursday, May 26, 2011
Security Requirements

                    • Secure Transactions
                    • Salting/Hashing Passwords
                    • Storing Passwords
                    • Password Strength Requirements
                    • Policies surrounding username selections

Thursday, May 26, 2011
User Impact

                    • Signup process
                     • Name
                     • Password (And Confirm)
                     • Email Address
                    • Yet another set of credentials

Thursday, May 26, 2011
flickr - @sbisson




             Offloading Authentication
Thursday, May 26, 2011
What is Offloading?
                    •    Authentication via third trusted party

                         •   User creates an account there (or likely already
                             has one)

                         •   They manage passwords and usernames

                    •    Host application passes user to authentication
                         provider

                    •    No passwords pass over your wire



Thursday, May 26, 2011
Why Offload?

                    • Dirty work is done for you
                     • No Passwords. Ever. None.
                     • No Username Selections
                    • Implementation is quick and easy
                    • Signup is fast

Thursday, May 26, 2011
Effectiveness

                    • Quick Conversion
                    • Personal Information
                    • Demographic Information


Thursday, May 26, 2011
Downsides


                    • Indentured to a provider
                    • Require a third party for a critical aspect of
                         your application




Thursday, May 26, 2011
Who To Use?




Thursday, May 26, 2011
Finding a Provider

                    • Reliability
                    • Support
                    • Trust from users
                    • Usage
                    • Longevity

Thursday, May 26, 2011
Make A Choice


                    • Pick the right service for your audience
                    • Choose multiple services


Thursday, May 26, 2011
Getting Started
Thursday, May 26, 2011
First Step

                    • Getting to know the technologies
                     • OpenID
                     • OAuth


Thursday, May 26, 2011
OpenID

                    • One login, multiple sites
                    • Decentralized
                    • URI-based. EX: jfaustin.myopenid.com
                    • Service provided by anyone

Thursday, May 26, 2011
OpenID Workflow




Thursday, May 26, 2011
OpenID
                    • Hasn’t really caught on
                    • Thought of as “geek speak”
                    • Service providers include
                     • Google
                     • Yahoo
                     • Many more...
Thursday, May 26, 2011
OAuth

                    • Open standard for access delegation
                    • With authentication, provides ability for
                         SSO
                    • Valet key to the internet


Thursday, May 26, 2011
OAuth Players
                    • Service Provider (Server)- Has the
                         information you want
                    • Consumer (Client) - Wants the information
                         from the Service Provider
                    • User (Resource Owner) - Can grant access
                         to the Consumer to acquire information
                         about your account from the Service
                         Provider


Thursday, May 26, 2011
Thursday, May 26, 2011
OAuth

                    • Technology behind authentication from
                     • Facebook
                     • Yahoo!
                     • Twitter

Thursday, May 26, 2011
Sign in with Twitter
Thursday, May 26, 2011
Get Started

                    • Register your app with Twitter
                     • https://dev.twitter.com/apps/new
                    • Add some UI to your app
                    • Choose an OAuth lib to help

Thursday, May 26, 2011
OAuth Libraries
                    • oauth-php
                         http://code.google.com/p/oauth-php/


                    • Zend_Oauth
                         http://framework.zend.com/manual/en/
                         zend.oauth.introduction.html


                    • OAuth PECL package
                         http://pecl.php.net/package/oauth


                    • CakePHP OAuth Package
                         http://code.42dh.com/oauth/



Thursday, May 26, 2011
Files Needed


             index.php           auth.php         callback.php



               * Need a OAuth library. We’re going to use ZF


Thursday, May 26, 2011
Logging In
        <?php
        // index.php

        if (isset($_SESSION['auth'])) {
            echo "Logged in";
            echo "<br><br><pre>";
            print_r($_SESSION['auth']);
            echo "</pre>";
            echo "<a href='logout.php'>Logout</a>";
        } else {
            echo "Not logged in";
            echo "<br><br>";
            echo "<a href='auth.php'>Sign in to twitter</a>";
        }




Thursday, May 26, 2011
Authentication
                <?php
                // auth.php

                if (isset($_SESSION['auth'])) {
                    echo "already logged in";
                    die();
                }

                $options = array(
                    'consumerKey'      =>   'asdfgawe23aewvserg43tg',
                    'consumerSecret'   =>   'asdf34visnerfg9j0ae49gj09srjg9ae',
                    'callbackUrl'      =>   'http://pintlabs.com/demo/callback.php',
                    'siteUrl'          =>   'http://twitter.com/oauth'
                );

                require_once 'Zend/Oauth/Consumer.php';
                $consumer = new Zend_Oauth_Consumer($options);

                $token = $consumer->getRequestToken();

                $_SESSION['requestToken'] = serialize($token);

                $consumer->redirect();




Thursday, May 26, 2011
<?php
                         Receive the Callback
                // callback.php

                if (!isset($_GET['oauth_token'])) {
                    die("oauth_token not set");
                }

                $response = array(
                    'oauth_token'    => $_GET['oauth_token'],
                    'oauth_verifier' => $_GET['oauth_verifier'],
                );

                // same options as auth.php
                $consumer = new Zend_Oauth_Consumer($options);

                $requestToken = unserialize($_SESSION['requestToken']);


                $accessToken = $consumer->getAccessToken($response, $requestToken);

                unset($_SESSION['requestToken']);

                parse_str($accessToken->getResponse()->getBody(), $params);

                $_SESSION['auth'] = $params;



Thursday, May 26, 2011
Best Practices
Thursday, May 26, 2011
A Few Things To
                           Remember...
                    • What if the external key changes?
                     • Changed OpenID URL
                     • Changed Twitter ID
                    • Multiple accounts from the same user

Thursday, May 26, 2011
Account Management

                    • Have an internal application account id
                    • Link external accounts to internal id
                    • Allow management of external
                         authentication sources by the user




Thursday, May 26, 2011
Have A Backup Plan

                    • Downtime
                    • Removal of service
                    • Change in service


Thursday, May 26, 2011
Questions?
                    Jason Austin - @jason_austin - jfaustin@gmail.com




                                     http://joind.in/3431




                                     Code Available at
                         http://github.com/jfaustin/tek11-twitter-auth




Thursday, May 26, 2011

Más contenido relacionado

Último

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

The Last Authentication System You Will Ever Write

  • 1. The Last Authentication System You Will Ever Write Jason Austin - @jason_austin - jfaustin@gmail.com Thursday, May 26, 2011
  • 2. A Quick Rundown • Authentication Basics • Pros/Cons of offloading • Authentication Mechanisms • Authentication Providers • Implementation Thursday, May 26, 2011
  • 3. Authentication Basics Authentication != Authorization flickr - @digiart2001 Who you are vs. what rights you have Thursday, May 26, 2011
  • 4. Setting Up An Auth System • Signup • Confirmation • Authenticate (Username / Password) • Password Retrieval / Reset • Password Change Thursday, May 26, 2011
  • 5. Security Requirements • Secure Transactions • Salting/Hashing Passwords • Storing Passwords • Password Strength Requirements • Policies surrounding username selections Thursday, May 26, 2011
  • 6. User Impact • Signup process • Name • Password (And Confirm) • Email Address • Yet another set of credentials Thursday, May 26, 2011
  • 7. flickr - @sbisson Offloading Authentication Thursday, May 26, 2011
  • 8. What is Offloading? • Authentication via third trusted party • User creates an account there (or likely already has one) • They manage passwords and usernames • Host application passes user to authentication provider • No passwords pass over your wire Thursday, May 26, 2011
  • 9. Why Offload? • Dirty work is done for you • No Passwords. Ever. None. • No Username Selections • Implementation is quick and easy • Signup is fast Thursday, May 26, 2011
  • 10. Effectiveness • Quick Conversion • Personal Information • Demographic Information Thursday, May 26, 2011
  • 11. Downsides • Indentured to a provider • Require a third party for a critical aspect of your application Thursday, May 26, 2011
  • 12. Who To Use? Thursday, May 26, 2011
  • 13. Finding a Provider • Reliability • Support • Trust from users • Usage • Longevity Thursday, May 26, 2011
  • 14. Make A Choice • Pick the right service for your audience • Choose multiple services Thursday, May 26, 2011
  • 16. First Step • Getting to know the technologies • OpenID • OAuth Thursday, May 26, 2011
  • 17. OpenID • One login, multiple sites • Decentralized • URI-based. EX: jfaustin.myopenid.com • Service provided by anyone Thursday, May 26, 2011
  • 19. OpenID • Hasn’t really caught on • Thought of as “geek speak” • Service providers include • Google • Yahoo • Many more... Thursday, May 26, 2011
  • 20. OAuth • Open standard for access delegation • With authentication, provides ability for SSO • Valet key to the internet Thursday, May 26, 2011
  • 21. OAuth Players • Service Provider (Server)- Has the information you want • Consumer (Client) - Wants the information from the Service Provider • User (Resource Owner) - Can grant access to the Consumer to acquire information about your account from the Service Provider Thursday, May 26, 2011
  • 23. OAuth • Technology behind authentication from • Facebook • Yahoo! • Twitter Thursday, May 26, 2011
  • 24. Sign in with Twitter Thursday, May 26, 2011
  • 25. Get Started • Register your app with Twitter • https://dev.twitter.com/apps/new • Add some UI to your app • Choose an OAuth lib to help Thursday, May 26, 2011
  • 26. OAuth Libraries • oauth-php http://code.google.com/p/oauth-php/ • Zend_Oauth http://framework.zend.com/manual/en/ zend.oauth.introduction.html • OAuth PECL package http://pecl.php.net/package/oauth • CakePHP OAuth Package http://code.42dh.com/oauth/ Thursday, May 26, 2011
  • 27. Files Needed index.php auth.php callback.php * Need a OAuth library. We’re going to use ZF Thursday, May 26, 2011
  • 28. Logging In <?php // index.php if (isset($_SESSION['auth'])) { echo "Logged in"; echo "<br><br><pre>"; print_r($_SESSION['auth']); echo "</pre>"; echo "<a href='logout.php'>Logout</a>"; } else { echo "Not logged in"; echo "<br><br>"; echo "<a href='auth.php'>Sign in to twitter</a>"; } Thursday, May 26, 2011
  • 29. Authentication <?php // auth.php if (isset($_SESSION['auth'])) { echo "already logged in"; die(); } $options = array( 'consumerKey' => 'asdfgawe23aewvserg43tg', 'consumerSecret' => 'asdf34visnerfg9j0ae49gj09srjg9ae', 'callbackUrl' => 'http://pintlabs.com/demo/callback.php', 'siteUrl' => 'http://twitter.com/oauth' ); require_once 'Zend/Oauth/Consumer.php'; $consumer = new Zend_Oauth_Consumer($options); $token = $consumer->getRequestToken(); $_SESSION['requestToken'] = serialize($token); $consumer->redirect(); Thursday, May 26, 2011
  • 30. <?php Receive the Callback // callback.php if (!isset($_GET['oauth_token'])) { die("oauth_token not set"); } $response = array( 'oauth_token' => $_GET['oauth_token'], 'oauth_verifier' => $_GET['oauth_verifier'], ); // same options as auth.php $consumer = new Zend_Oauth_Consumer($options); $requestToken = unserialize($_SESSION['requestToken']); $accessToken = $consumer->getAccessToken($response, $requestToken); unset($_SESSION['requestToken']); parse_str($accessToken->getResponse()->getBody(), $params); $_SESSION['auth'] = $params; Thursday, May 26, 2011
  • 32. A Few Things To Remember... • What if the external key changes? • Changed OpenID URL • Changed Twitter ID • Multiple accounts from the same user Thursday, May 26, 2011
  • 33. Account Management • Have an internal application account id • Link external accounts to internal id • Allow management of external authentication sources by the user Thursday, May 26, 2011
  • 34. Have A Backup Plan • Downtime • Removal of service • Change in service Thursday, May 26, 2011
  • 35. Questions? Jason Austin - @jason_austin - jfaustin@gmail.com http://joind.in/3431 Code Available at http://github.com/jfaustin/tek11-twitter-auth Thursday, May 26, 2011