Skip to content

Commit

Permalink
changing to v0.3.1 API
Browse files Browse the repository at this point in the history
  • Loading branch information
NoamB committed Apr 17, 2011
1 parent dcf5ff6 commit 3797b1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -2,4 +2,4 @@ source 'http://rubygems.org'

gem 'sinatra', '>= 1.2.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem "sorcery", '0.2.1'
gem "sorcery", '0.3.1'
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -75,7 +75,7 @@ GEM
sinatra (1.2.1)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
sorcery (0.2.1)
sorcery (0.3.1)
bcrypt-ruby (~> 2.1.4)
json (>= 1.5.1)
oauth (>= 0.4.4)
Expand Down
12 changes: 6 additions & 6 deletions myapp.rb
Expand Up @@ -32,7 +32,7 @@

# models
require 'sorcery'
Sorcery::Controller::Config.submodules = [:user_activation, :http_basic_auth, :remember_me, :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :oauth]
Sorcery::Controller::Config.submodules = [:user_activation, :http_basic_auth, :remember_me, :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :external]
include Sorcery::Controller::Adapters::Sinatra
include Sorcery::Controller

Expand All @@ -42,7 +42,7 @@

config.controller_to_realm_map = {"application" => "Application", "users" => "Users"}

config.oauth_providers = [:twitter, :facebook]
config.external_providers = [:twitter, :facebook]

config.twitter.key = "eYVNBjBDi33aa9GkA3w"
config.twitter.secret = "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8"
Expand Down Expand Up @@ -177,19 +177,19 @@ def not_authenticated
erb "HTTP Basic Auth"
end

# OAuth
# External
get '/auth_at_provider' do
auth_at_provider(params[:provider])
login_at(params[:provider])
end

get '/oauth/callback' do
provider = params[:provider]
@user = login_from_access_token(provider)
@user = login_from(provider)
if @user
session[:notice] = "Success!"
redirect '/'
else
if @user = create_from_provider!(provider)
if @user = create_from(provider)
@user.activate!
session.clear # protect from session fixation attack
login_user(@user)
Expand Down

0 comments on commit 3797b1f

Please sign in to comment.