github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

binarylogic / authlogic

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2,502
    • 180
  • Source
  • Commits
  • Network (180)
  • Issues (66)
  • Downloads (47)
  • Wiki (1)
  • Graphs
  • Tree: 7cd869f

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (47)
    • v2.1.3
    • v2.1.2
    • v2.1.1
    • v2.1.0
    • v2.0.14
    • v2.0.13
    • v2.0.12
    • v2.0.11
    • v2.0.10
    • v2.0.9
    • v2.0.8
    • v2.0.7
    • v2.0.6
    • v2.0.5
    • v2.0.4
    • v2.0.3
    • v2.0.2
    • v2.0.1
    • v2.0.0RC1
    • v2.0.0
    • v1.4.3
    • v1.4.2
    • v1.4.1
    • v1.4.0
    • v1.3.9
    • v1.3.8
    • v1.3.7
    • v1.3.6
    • v1.3.5
    • v1.3.4
    • v1.3.3
    • v1.3.2
    • v1.3.1
    • v1.3.0
    • v1.2.2
    • v1.2.1
    • v1.2.0
    • v1.1.1
    • v1.1.0
    • v1.0.0
    • v0.10.4
    • v0.10.3
    • v0.10.2
    • v0.10.1
    • v0.10.0
    • v0.9.1
    • v0.9.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A simple model based ruby authentication solution. — Read more

  cancel

http://rdoc.info/projects/binarylogic/authlogic

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Small code cleanup Comment
binarylogic (author)
Mon Feb 16 23:45:12 -0800 2009
commit  7cd869f49a264cb7ece7e72df8ff077c06fdc5d3
tree    b55ca4db7fea3c2d6bac63a8bfaf34733c3a0899
parent  febb7c170046fa6693bf0647fd6edb488045a20d
authlogic / lib / authlogic / session / params.rb lib/authlogic/session/params.rb
100644 32 lines (31 sloc) 1.561 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module Authlogic
  module Session
    # = Params
    #
    # Tries to log the user in via params. Think about cookies and sessions. They are just hashes in your controller, so are params. People never
    # look at params as an authentication option, but it can be useful for logging into private feeds, etc. Logging in a user is as simple as:
    #
    # https://www.domain.com?user_credentials=[insert single access token here]
    #
    # Wait, what is a single access token? It is all explained in the README. Checkout the "Tokens" section in the README, there is section about
    # single access tokens. For security reasons, this type of authentication is ONLY available via single access tokens, you can NOT pass your persistence token.
    # Which means you must have a single_access_token field in your database.
    module Params
      # Tries to validate the session from information in the params token
      def valid_params?
        if params_credentials && single_access_token_field && (single_access_allowed_request_types.include?(controller.request_content_type) || single_access_allowed_request_types.include?(:all) || controller.single_access_allowed?)
          self.unauthorized_record = search_for_record("find_by_#{single_access_token_field}", params_credentials)
          self.persisting = false
          return true if valid?
          self.persisting = true
        else
          false
        end
      end
      
      private
        def params_credentials
          controller.params[params_key]
        end
    end
  end
end
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server