Skip to content

Commit 82de86a

Browse files
committed
Modified the readme
1 parent fb04757 commit 82de86a

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2009 James Daniels
1+
Copyright (c) 2010 James Daniels
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.rdoc renamed to README.textile

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
= Lasso
1+
h1. Lasso
22

3-
== Identity herding with OAuth
3+
h2. Identity herding with OAuth
44

55
Lasso makes it damn easy to add SSO to your Rails application. Just load in your configuration, add a couple associations, and you are set to hit the trail running, partner.
66

7-
== Gettings started
7+
h3. Gettings started
88

99
I haven't made generators for anything but that's ok cause Lasso mostly works via decorators.
1010

1111
Lasso creates OAuth tokens via nested attributes on whichever object you deem to be the owner of those keys (e.g, current_user, current_user.account, User.new) which makes it one-to-many and quite flexible.
1212

13-
=== Configuration
13+
Feel free to skim this README in addition to checking out the "Lasso/Authlogic example application that I've built.":http://github.com/jamesdaniels/lasso-example
14+
15+
h3. Configuration
1416

1517
Add this line to your environment.rb:
1618

1719
config.gem 'lasso'
1820

19-
=== Schema
21+
h3. Schema
2022

2123
You are going to want a model with a schema that at least looks like this, you can call it what you wish:
2224

@@ -28,7 +30,7 @@ You are going to want a model with a schema that at least looks like this, you c
2830
t.datetime "created_at", "updated_at", :null => false
2931
end
3032

31-
=== Model
33+
h3. Model
3234

3335
Go ahead and add your provider details to the model, like so:
3436

@@ -51,13 +53,19 @@ Go ahead and add your provider details to the model, like so:
5153
end
5254
end
5355
end
56+
57+
You'll want to setup the association to your owner model too:
58+
59+
class User < ActiveRecord::Base
60+
has_many :access_keys, :dependent => :destroy, :as => :owner
61+
accepts_nested_attributes_for :access_keys
62+
end
5463

55-
=== Controller
64+
h3. Controller
5665

5766
You are going to want a controller that is able to handle the requests:
5867

5968
class OauthController < ApplicationController
60-
ssl_required :create
6169
processes_oauth_transactions_for :access_keys,
6270
:through => lambda { current_user },
6371
:callback => lambda { oauth_callback_url }
@@ -75,30 +83,30 @@ And a controller to show the user their AccessKeys:
7583
@access_key = current_user.access_keys.find(params[:id])
7684
end
7785

78-
def delete
86+
def destroy
7987
access_key = current_user.access_keys.find(params[:id])
8088
access_key.destroy
8189
redirect_to access_keys_path
8290
end
8391

8492
end
8593

86-
=== Routes
94+
h3. Routes
8795

8896
And maybe some routes:
8997

90-
map.resources :access_keys, :only => [:index, :show, :delete]
98+
map.resources :access_keys, :only => [:index, :show, :destroy]
9199

92100
map.oauth_authorize '/:service/oauth/start', :controller => 'oauth', :action => 'new'
93-
map.oauth_callback '/:service/oauth/callback', :controller => 'oauth', :action => 'create', :protocol => 'https'
101+
map.oauth_callback '/:service/oauth/callback', :controller => 'oauth', :action => 'create'
94102

95-
=== Usage
103+
h3. Usage
96104

97105
Now OAuth is as simple as adding a link:
98106

99107
<%= link_to 'Integrate your account with your 37signals account', oauth_authorize_path(:service => '37signals') %>
100108

101-
== Note on Patches/Pull Requests
109+
h3. Note on Patches/Pull Requests
102110

103111
* Fork the project.
104112
* Make your feature addition or bug fix.
@@ -108,6 +116,6 @@ Now OAuth is as simple as adding a link:
108116
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
109117
* Send me a pull request. Bonus points for topic branches.
110118

111-
== Copyright
119+
h2. Copyright
112120

113121
Copyright (c) 2010 James Daniels. See LICENSE for details.

lib/lasso/controller/instance.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def create
1515
if @owner.update_attributes(nested)
1616
redirect_to send("#{oauth_model.to_s.singularize}_path", @owner.send(oauth_model).last)
1717
else
18-
render :text => @oauth.to_yaml
18+
render :text => @owner.to_yaml
1919
end
2020
end
2121

0 commit comments

Comments
 (0)