SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Experience                            Technologies

                                                       V.P. Engineering
                                                       Dec 2011 - now


                                                       Software Engineer
                                                       August 2010 – Dec 2011


                                                       Software Engineer
Mihir A. Vaidya                                        Feb 2006 – August 2010
Co-Founder and
V.P. Engineering
ReadyPulse
                                                       Software Engineer
https://www.linkedin.com/in/vaidyamihir                May 2004 – Feb 2006
https://twitter.com/mihirvaidya
                                                       Researcher
                                                       May 2003 – May 2004
•

•
•
•
    –
    –
•
    –
    –
        •
            –
            –
            –
            –
            –
            –
    –
        •
•
•
    –

•
•
•
•

    –
•

•
    http_basic_authenticate_with
        :name => "ror",
        :password => "rocks",
        :except=>[:index]
•
    –
    –
    –
        •
        •
        •
        •
    –
        •
        •   current_user, authenticate_user!
    –

•
    –
    –
    –
    –
•
    –
•
    –
    –
        •
•
    –
•
    –
•
    –
•
    –
•
    –
    –
•
•
•
•
•
•
•
•
•
•
•
•
•
    –
    –
    –
•
    –
        •

    –
    –
•
    –
        •
            –
            –
        •
            –                            
            –
                »
                    •   Perform all authentication in a HTML POPUP with your own handler pages before and after
                        Facebook OAuth calls
    –
        •
        •
            –
            –
        •
            –
            –
•
•

•

    –   Sessions#fb_auth

•
•
    –


        •
        •
•
•
    –
•
    –
    –
        •
•
    –
    –                     (session[:user_id])
    –       (current_user, authenticate_user!)
•
•
•

•

•
    –

•
    –   gem „omniauth-twitter‟
    –   gem „omniauth-facebook‟
    –   bundle install

•
    –
          •
          Rails.application.config.middleware.use OmniAuth::Builder do
              provider :twitter,
                             APP_CONFIG[:twitter]['consumer_key'],
                             APP_CONFIG[:twitter]['consumer_secret']
              provider :facebook,
                   APP_CONFIG[:facebook]['app_id'],
                   APP_CONFIG[:facebook]['app_secret'],
                   :client_options => {
                        :ssl => { :ca_file => "#{Rails.root}/config/ca-bundle.crt" }
                   }
          End

•
•                 (/auth/:provider/callback)
    –   request.env[“omniauth.auth”]
•
    –
          •
          •

•
    –
    OmniAuth.config.on_failure = -> env do
     env[ActionDispatch::Flash::KEY] ||= ActionDispatch::Flash::FlashHash.new
     env[ActionDispatch::Flash::KEY][:error] = "Authentication failed, please try again."
     SessionsController.action(:new).call(env) #call whatever controller/action that displays your signup form
    end
•
    –
    –
    –
    –

•
    –
    –
•


    –
•


•
•
    – '/auth/:provider/callback' => 'sessions#create'
•
    –
•

    –

    –
•
•
    –

    provider :identity, on_failed_registration: lambda { |env|
        # lambda is used so that the class IdentitiesController is not cached (important for dev environment).
        # That way, changes to the controller will be picked up automatically since
        #              lamda is the rack application to handle failures and not IndentitiesController#new directly



        IdentitiesController.action(:new).call(env)
    }
•
    –

•
    –
    –
•
•
    –
•
•
    –
•
•
    –
        •
    –
        •
        •
•
    –
•
    –
    –
•
    –
        •
        •
    –
    –
•
    –
        •
•
    –
    –
•
    –

        •
        •
        •
        •
        •
    –

•

•
    –

        •
            –
•
    –

•
    –
    –
    –
        •
            –

    –
•
•
•
    –
    –
        •
        •
•
    –

    –
•
•
    –
•
    –
    –
        •
    –
        •
•
    –

•
    –
    –
        •
        •

        •
•
•
•
•
    –
    –
    –
    –
        •

    –
•
•
    –   
•
    –
    –
•
    –
    –
    –       
•
    –

•
•



•

•
•
•
•
    –
          •
          •
          •
    –
          •
•
    –
          •
                –
                –
                –
    –
          •
                –
                –
                –
•
•
    –   current_user
    –   authenticate_user!
•
    –
    –
    –

    –
        •   password_salt = BCrypt::Engine.generate_salt
        •   password_hash = BCrypt::Engine.hash_secret(password, password_salt)

•

    –
•
    –

•
    –

        •
    –

Weitere ähnliche Inhalte

Ähnlich wie Authentication in-rails

SharePoint Saturday Philly - SharePoint 2010 Administrative Blunders
SharePoint Saturday Philly - SharePoint 2010 Administrative BlundersSharePoint Saturday Philly - SharePoint 2010 Administrative Blunders
SharePoint Saturday Philly - SharePoint 2010 Administrative Blunders
Dan Usher
 

Ähnlich wie Authentication in-rails (20)

Brute Force - Lior Rotkovitch - f5 SIRT v5.pdf
Brute Force - Lior Rotkovitch - f5 SIRT v5.pdfBrute Force - Lior Rotkovitch - f5 SIRT v5.pdf
Brute Force - Lior Rotkovitch - f5 SIRT v5.pdf
 
Testing mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP frameworkTesting mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP framework
 
Poisoning Google images
Poisoning Google imagesPoisoning Google images
Poisoning Google images
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
 
IBM Connection - customize it, #dd13
IBM Connection - customize it, #dd13IBM Connection - customize it, #dd13
IBM Connection - customize it, #dd13
 
下吧开发总结
下吧开发总结下吧开发总结
下吧开发总结
 
Leadership Guide, 초보팀장을 위한 리더십 가이드
Leadership Guide, 초보팀장을 위한 리더십 가이드Leadership Guide, 초보팀장을 위한 리더십 가이드
Leadership Guide, 초보팀장을 위한 리더십 가이드
 
SharePoint Saturday Philly - SharePoint 2010 Administrative Blunders
SharePoint Saturday Philly - SharePoint 2010 Administrative BlundersSharePoint Saturday Philly - SharePoint 2010 Administrative Blunders
SharePoint Saturday Philly - SharePoint 2010 Administrative Blunders
 
SPSPhilly - SharePoint 2010 Tips & Tricks of the Trade - Avoiding Administrat...
SPSPhilly - SharePoint 2010 Tips & Tricks of the Trade - Avoiding Administrat...SPSPhilly - SharePoint 2010 Tips & Tricks of the Trade - Avoiding Administrat...
SPSPhilly - SharePoint 2010 Tips & Tricks of the Trade - Avoiding Administrat...
 
Getting Started With SharePoint REST API in Nintex Workflows for Office 365 I...
Getting Started With SharePoint REST API in Nintex Workflows for Office 365 I...Getting Started With SharePoint REST API in Nintex Workflows for Office 365 I...
Getting Started With SharePoint REST API in Nintex Workflows for Office 365 I...
 
Sucuri Webinar: Website Security for Web Agencies
Sucuri Webinar: Website Security for Web AgenciesSucuri Webinar: Website Security for Web Agencies
Sucuri Webinar: Website Security for Web Agencies
 
Google-image poisoning: How hackers use images to spread malware
Google-image poisoning: How hackers use images to spread malwareGoogle-image poisoning: How hackers use images to spread malware
Google-image poisoning: How hackers use images to spread malware
 
(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...
(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...
(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...
 
memories of tumblr gear & Tumblrowl
memories of tumblr gear & Tumblrowlmemories of tumblr gear & Tumblrowl
memories of tumblr gear & Tumblrowl
 
Chaione Ember.js Training
Chaione Ember.js TrainingChaione Ember.js Training
Chaione Ember.js Training
 
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
 
BSides São Paulo - Trabalho no exterior e segurança de aplicações
BSides São Paulo - Trabalho no exterior e segurança de aplicaçõesBSides São Paulo - Trabalho no exterior e segurança de aplicações
BSides São Paulo - Trabalho no exterior e segurança de aplicações
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & Features
 
Premature optimisation: The Root of All Evil
Premature optimisation: The Root of All EvilPremature optimisation: The Root of All Evil
Premature optimisation: The Root of All Evil
 
DevCommerce Conference 2016: Performance, anti-patterns e stacks pra desenvol...
DevCommerce Conference 2016: Performance, anti-patterns e stacks pra desenvol...DevCommerce Conference 2016: Performance, anti-patterns e stacks pra desenvol...
DevCommerce Conference 2016: Performance, anti-patterns e stacks pra desenvol...
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Authentication in-rails

  • 1.
  • 2. Experience Technologies V.P. Engineering Dec 2011 - now Software Engineer August 2010 – Dec 2011 Software Engineer Mihir A. Vaidya Feb 2006 – August 2010 Co-Founder and V.P. Engineering ReadyPulse Software Engineer https://www.linkedin.com/in/vaidyamihir May 2004 – Feb 2006 https://twitter.com/mihirvaidya Researcher May 2003 – May 2004
  • 4. – –
  • 5. – – • – – – – – – – •
  • 6. • • – • • •
  • 7. – • • http_basic_authenticate_with :name => "ror", :password => "rocks", :except=>[:index]
  • 8. – – – • • • • – • • current_user, authenticate_user! – • – – – –
  • 9.
  • 10. – – • • – • – • – • – • – – • • • • •
  • 12. • • • – – – • – • – –
  • 13. – • – – • –  – » • Perform all authentication in a HTML POPUP with your own handler pages before and after Facebook OAuth calls – • • – – • – –
  • 14.
  • 15. • • – Sessions#fb_auth •
  • 16. – • •
  • 17. • • – • – – • • – – (session[:user_id]) – (current_user, authenticate_user!) • •
  • 18. • • • – • – gem „omniauth-twitter‟ – gem „omniauth-facebook‟ – bundle install • – • Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter, APP_CONFIG[:twitter]['consumer_key'], APP_CONFIG[:twitter]['consumer_secret'] provider :facebook, APP_CONFIG[:facebook]['app_id'], APP_CONFIG[:facebook]['app_secret'], :client_options => { :ssl => { :ca_file => "#{Rails.root}/config/ca-bundle.crt" } } End • • (/auth/:provider/callback) – request.env[“omniauth.auth”]
  • 19. – • • • – OmniAuth.config.on_failure = -> env do env[ActionDispatch::Flash::KEY] ||= ActionDispatch::Flash::FlashHash.new env[ActionDispatch::Flash::KEY][:error] = "Authentication failed, please try again." SessionsController.action(:new).call(env) #call whatever controller/action that displays your signup form end
  • 20. – – – – • – –
  • 21. – • •
  • 22. – '/auth/:provider/callback' => 'sessions#create' • – • – – •
  • 23. – provider :identity, on_failed_registration: lambda { |env| # lambda is used so that the class IdentitiesController is not cached (important for dev environment). # That way, changes to the controller will be picked up automatically since # lamda is the rack application to handle failures and not IndentitiesController#new directly IdentitiesController.action(:new).call(env) }
  • 24. – • – –
  • 25. • • – • • – • • – • – • • • –
  • 26. – – • – • • – – • – • • – –
  • 27. – • • • • • –
  • 28.  • • – • –
  • 29. – • – – – • – –
  • 30. • • • – – • • • – –
  • 31. • •
  • 32. – – • – • • – • – – • • •
  • 33. • • • • – – – – • –
  • 34. • • –  • – – • – – –  • – •
  • 37.
  • 38.
  • 39.
  • 40. – • • • – • • – • – – – – • – – – • • – current_user – authenticate_user!
  • 41. – – – – • password_salt = BCrypt::Engine.generate_salt • password_hash = BCrypt::Engine.hash_secret(password, password_salt) • –
  • 42. – • – • –