priit-openid_wrapper 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/CHANGELOG.rdoc +1 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +126 -0
  4. metadata +68 -0
@@ -0,0 +1 @@
1
+ please use 'git log' for changes
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Priit Tamboom
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,126 @@
1
+
2
+ = OpenidWrapper
3
+
4
+
5
+ Thin OpenID Consumer Wrapper for Ruby on Rails using ruby-openid gem.
6
+
7
+
8
+ == SHORT STORY
9
+
10
+ It helps to keep your session controller nice and clean and provides
11
+ some handy methods such as begin_openid, complete_openid and openid_params.
12
+
13
+
14
+ == LONG STORY
15
+
16
+ The goal is to have openid consumer wrapper, what follows more closely
17
+ the spirit of OpenID spec and the same time provides some handy methods.
18
+
19
+ No more you need squeezed openid through one method as in the original plugin,
20
+ enjoy same clarity as you will find in OpenID spec, so it means when you start request
21
+ then you just use method begin_openid (aliased to create_openid) and when you complete
22
+ your request, then use method complete_openid.
23
+
24
+ note: this wrapper is made openid only in mind, so that's why it
25
+ might not be the quickest fit for you if you also need old way of
26
+ username-password authentication, however they play nice together if you want so.
27
+
28
+
29
+ = Installation
30
+
31
+ First you need Rails 2.1.0 or newer.
32
+
33
+ Start with:
34
+
35
+ gem sources -a http://gems.github.com
36
+ sudo gem install priit-openid_wrapper
37
+
38
+ Add to config/environment.rb:
39
+
40
+ config.gem 'priit-openid_wrapper', :lib => 'openid_wrapper', :source => 'http://gems.github.com'
41
+
42
+ Add to config/routes.rb:
43
+
44
+ map.resources :users
45
+
46
+ # OpenID spec does not honor RESTful design,
47
+ # so we need add complete action as well.
48
+ map.resources :sessions, :collection => {:complete => :get}
49
+
50
+ # some handy shortcuts, you can use as link_to 'Signup', signup_path
51
+ map.signup '/signup', :controller => 'users', :action => 'new'
52
+ map.login '/login', :controller => 'sessions', :action => 'new'
53
+ map.logout '/logout', :controller => 'sessions', :action => 'destroy'
54
+
55
+ Add to app/controller/sessions_controller.rb # Look how slim and clean controller :-)
56
+ def create
57
+ begin_openid # you can change defaults like :return_url => complete_sessions_url etc
58
+ # take a look lib/openid_wrapper/openid_wrapper.rb def begin_openid
59
+ end
60
+
61
+ def complete
62
+ case complete_openid.status
63
+ when :success
64
+ user = User.find_by_openid_identifier(params[:openid][:openid_identifier])
65
+ if user.nil?
66
+ user = User.create(params[:openid])
67
+ end
68
+ session[:current_user_id] = user.id
69
+ flash[:success] = "Logged in succesfully!"
70
+ return redirect_to root_path
71
+ when :failure
72
+ flash[:error] = 'Something went wrong!'
73
+ when :cancel
74
+ flash[:error] = 'Openid login cancelled!'
75
+ when :setup_needed
76
+ flash[:notice] = 'Openid setup needed!'
77
+ end
78
+ return redirect_to root_path
79
+ end
80
+
81
+ Add to app/views/users/new.html.haml:
82
+
83
+ - form_tag sessions_path do
84
+ = text_field_tag :openid_identifier
85
+ = submit_tag 'Login'
86
+
87
+
88
+ == Additional Tips and Notes
89
+
90
+ * Make OpenID identifier field more nuby friendly and
91
+ add OpenID official selector from https://www.idselector.com/
92
+
93
+ * OpenID Wrapper will generate log entry:
94
+ ** openid_wrapper: initialized properly.
95
+
96
+
97
+ == How to contribute?
98
+
99
+ You are welcome to clone it at your favourite git repository:
100
+
101
+ http://gitorious.org/projects/openid-wrapper
102
+ http://github.com/priit/openid-wrapper/
103
+ http://rubyforge.org/projects/openid-wrapper/
104
+
105
+ Check out TODO file to find out some pending tasks or do whatever you
106
+ like to improve. Just send merge request, when you like to push
107
+ your improvements.
108
+
109
+
110
+ == General Info about OpenID
111
+
112
+ OpenID Authentication 2.0 - final specifications
113
+ http://openid.net/specs/openid-authentication-2_0.html
114
+
115
+
116
+ == History and Credits
117
+
118
+ * OpenID Authentication plugin started by David Heinemeier Hansson.[1]
119
+ * Alex Gorbatchev made complete clean up without changing original API.[2]
120
+ * Priit Tamboom made complete API change as well and gemified it.[3]
121
+
122
+ 1. http://svn.rubyonrails.org/rails/plugins/open_id_authentication/
123
+ 2. http://code.google.com/p/open-id-authentication/
124
+ 3. http://gitorious.org/projects/openid-wrapper/
125
+
126
+ Copyright (c) 2008 Priit Tamboom, released under the MIT license
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: priit-openid_wrapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ platform: ruby
6
+ authors:
7
+ - Priit Tamboom
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-26 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ruby-openid
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.1.2
23
+ version:
24
+ description: Openid wrapper for Rails yeah
25
+ email: priit@mx.ee
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README.rdoc
32
+ - MIT-LICENSE
33
+ - CHANGELOG.rdoc
34
+ files:
35
+ - README.rdoc
36
+ - MIT-LICENSE
37
+ - CHANGELOG.rdoc
38
+ has_rdoc: true
39
+ homepage: http://priit.mx.ee/openid_wrapper
40
+ post_install_message:
41
+ rdoc_options:
42
+ - --main
43
+ - README.rdoc
44
+ - --inline-source
45
+ - --charset=UTF-8
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project: openid_wrapper
63
+ rubygems_version: 1.2.0
64
+ signing_key:
65
+ specification_version: 2
66
+ summary: Openid wrapper for Rails
67
+ test_files: []
68
+