cs50 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cs50.rb +13 -13
- metadata +3 -3
data/lib/cs50.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require "openid"
|
2
|
+
require "openid/extensions/ax"
|
3
|
+
require "openid/extensions/sreg"
|
4
|
+
require "openid/store/filesystem"
|
5
|
+
require "pathname"
|
6
6
|
|
7
|
-
# CS50
|
7
|
+
# User authentication using CS50 ID.
|
8
8
|
#
|
9
9
|
# Licensed under the {http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 Unported License}
|
10
10
|
#
|
@@ -16,7 +16,7 @@ class CS50
|
|
16
16
|
|
17
17
|
# Get URL to which user can be redirected to authenticate using CS50 ID.
|
18
18
|
#
|
19
|
-
# @param [String] directory Path to directory used to store state (i.e
|
19
|
+
# @param [String] directory Path to directory used to store state (i.e., <tt>Rails.root.join("tmp")</tt> for Ruby on Rails)
|
20
20
|
# @param [String] trust_root URL that CS50 ID should prompt user to trust
|
21
21
|
# @param [String] return_to URL to which CS50 should return user after login
|
22
22
|
# @param session Session variable (i.e. <tt>session</tt> for Ruby on Rails)
|
@@ -26,10 +26,10 @@ class CS50
|
|
26
26
|
# prepare request
|
27
27
|
store = OpenID::Store::Filesystem.new(Pathname.new(directory))
|
28
28
|
consumer = OpenID::Consumer.new(session, store)
|
29
|
-
auth_request = consumer.begin(
|
29
|
+
auth_request = consumer.begin("https://id.cs50.net/")
|
30
30
|
|
31
31
|
# simple registration fields
|
32
|
-
auth_request.add_extension(OpenID::SReg::Request.new([
|
32
|
+
auth_request.add_extension(OpenID::SReg::Request.new(["email"], ["fullname"]))
|
33
33
|
|
34
34
|
=begin AX code, removed for now due to URL length limitation in WEBrick
|
35
35
|
# attribute exchange attributes
|
@@ -46,10 +46,10 @@ class CS50
|
|
46
46
|
# If user has been authenticated by CS50 ID, get the user's information.
|
47
47
|
# @note A unique ID for the user *will* be returned, and the user's email and name *may* be returned.
|
48
48
|
#
|
49
|
-
# @param [String] directory Path to directory used to store state (i.e
|
49
|
+
# @param [String] directory Path to directory used to store state (i.e., <tt>Rails.root.join("tmp")</tt> for Ruby on Rails)
|
50
50
|
# @param [String] return_to URL to which CS50 should return user after login
|
51
|
-
# @param session Session variable (i.e
|
52
|
-
# @param params Parameters array (i.e
|
51
|
+
# @param session Session variable (i.e., <tt>session</tt> for Ruby on Rails)
|
52
|
+
# @param params Parameters array (i.e., <tt>params</tt> for Ruby on Rails)
|
53
53
|
# @return [Hash] User's <tt>:id</tt>, <tt>:email</tt> and <tt>:name</tt>
|
54
54
|
#
|
55
55
|
def self.getUser(directory, return_to, session, params)
|
@@ -90,7 +90,7 @@ class CS50
|
|
90
90
|
user[:name] = sreg_resp["fullname"]
|
91
91
|
end
|
92
92
|
|
93
|
-
return user
|
93
|
+
return user
|
94
94
|
|
95
95
|
# response failure
|
96
96
|
else
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cs50
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tommy MacWilliam
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-13 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -61,6 +61,6 @@ rubyforge_project:
|
|
61
61
|
rubygems_version: 1.6.2
|
62
62
|
signing_key:
|
63
63
|
specification_version: 3
|
64
|
-
summary:
|
64
|
+
summary: Ruby library for CS50 ID
|
65
65
|
test_files: []
|
66
66
|
|