File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -2,4 +2,6 @@ source "https://rubygems.org"
22
33git_source ( :github ) { |repo_name | "https://github.com/#{ repo_name } " }
44
5+ gem "sinatra" , ">= 2.0"
6+ gem "omniauth" , ">= 2.0"
57gem "omniauth-open-edx" , path : "../../"
Original file line number Diff line number Diff line change 11begin
22 require "sinatra"
3+ require "securerandom"
34 require "omniauth"
45 require "omniauth-open-edx"
56rescue LoadError
67 require "rubygems"
8+ require "securerandom"
79 require "sinatra"
810 require "omniauth"
911 require "omniauth-open-edx"
1012end
1113
14+ set sessions : true
15+ set :session_secret , ENV . fetch ( "SESSION_SECRET" ) { SecureRandom . hex ( 64 ) }
16+
1217use Rack ::Session ::Cookie
1318use OmniAuth ::Builder do
1419 provider :open_edx ,
2429
2530get "/" do
2631 <<-HTML
27- < a href ='/auth/open_edx '> Sign in with Open edX</ a >
32+ < form method ='post ' action ='/auth/open_edx '>
33+ < input type ="hidden " name ="authenticity_token " value ='#{ request . env [ "rack.session" ] [ "csrf" ] } '>
34+ < button type ='submit '> Sign in with Open edX</ button >
35+ </ form>
2836 HTML
2937end
3038
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
2929 spec . require_paths = [ "lib" ]
3030
3131 spec . add_dependency "jwt" , ">= 2.0"
32- spec . add_dependency "omniauth" , [ ">= 1.9" , "< 2 " ]
32+ spec . add_dependency "omniauth" , [ ">= 1.9" , "< 3 " ]
3333 spec . add_dependency "omniauth-oauth2" , ">= 1.4"
3434
3535 spec . add_development_dependency "bundler" , ">= 2.0"
You can’t perform that action at this time.
0 commit comments