omniauth-nctu 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +23 -11
- data/example/config.ru +16 -25
- data/lib/omniauth/nctu/version.rb +1 -1
- data/lib/omniauth/strategies/nctu.rb +4 -1
- metadata +1 -4
- data/.rspec +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec20404fb79a769de42f06583db429c11b5decb1
|
4
|
+
data.tar.gz: 192ac2d6546ff81c1fd35c9fd305f4d03476af69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f83c70977c1379adb7ca82a1acafed3ce27a7c69b5f116ddcf0db84f1b1d00fd9aaf188eecbdc34fbb6577f2543909353401b39302dc0d31bac5488582d5e8
|
7
|
+
data.tar.gz: 56d93de1e712afdd20d560f92914d95dc58a59d5c3ae4d1189766aa7ee0eacbebf7d7ef4faed3f9eb80184f56a38bccfc57937f964ef8e2df2ff1a86790911b6
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Omniauth::Nctu
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
使用OmniAuth實作NCTU-Oauth登入認證的Ruby套件
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -20,19 +18,33 @@ Or install it yourself as:
|
|
20
18
|
|
21
19
|
$ gem install omniauth-nctu
|
22
20
|
|
23
|
-
##
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
21
|
+
## Example
|
28
22
|
|
29
|
-
|
23
|
+
```ruby
|
24
|
+
require 'sinatra'
|
25
|
+
require 'omniauth-nctu'
|
26
|
+
|
27
|
+
use Rack::Session::Cookie
|
28
|
+
use OmniAuth::Builder do
|
29
|
+
provider :nctu, ENV['NCTU_OAUTH_KEY'], ENV['NCTU_OAUTH_SECRET']
|
30
|
+
end
|
31
|
+
|
32
|
+
get '/' do
|
33
|
+
<<-HTML
|
34
|
+
<a href='/auth/nctu'>Sign in with NCTU</a>
|
35
|
+
HTML
|
36
|
+
end
|
37
|
+
|
38
|
+
get '/auth/nctu/callback' do
|
39
|
+
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
|
40
|
+
erb "您好,#{request.env['omniauth.auth'].to_hash["uid"]}。您的D2信箱是#{request.env['omniauth.auth'].to_hash["info"]["d2_email"]}。"
|
41
|
+
end
|
42
|
+
```
|
30
43
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
44
|
|
33
45
|
## Contributing
|
34
46
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deror1869107/omniauth-nctu.
|
36
48
|
|
37
49
|
|
38
50
|
## License
|
data/example/config.ru
CHANGED
@@ -1,28 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'omniauth'
|
4
|
-
require 'omniauth-nctu'
|
5
|
-
rescue LoadError
|
6
|
-
require 'rubygems'
|
7
|
-
require 'sinatra'
|
8
|
-
require 'omniauth'
|
9
|
-
require 'openid/store/filesystem'
|
10
|
-
require 'omniauth-nctu'
|
11
|
-
end
|
1
|
+
require 'sinatra'
|
2
|
+
require 'omniauth-nctu'
|
12
3
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
use Rack::Session::Cookie
|
5
|
+
use OmniAuth::Builder do
|
6
|
+
provider :nctu, ENV['NCTU_OAUTH_KEY'], ENV['NCTU_OAUTH_SECRET']
|
7
|
+
end
|
17
8
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
get '/' do
|
10
|
+
<<-HTML
|
11
|
+
<a href='/auth/nctu'>Sign in with NCTU</a>
|
12
|
+
HTML
|
13
|
+
end
|
23
14
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
get '/auth/nctu/callback' do
|
16
|
+
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
|
17
|
+
puts request.env['omniauth.auth']
|
18
|
+
erb "您好,#{request.env['omniauth.auth'].to_hash["uid"]}。您的D2信箱是#{request.env['omniauth.auth'].to_hash["info"]["d2_email"]}。"
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-nctu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuan-Yao Sung
|
@@ -89,14 +89,11 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
-
- ".rspec"
|
93
92
|
- ".travis.yml"
|
94
93
|
- Gemfile
|
95
94
|
- LICENSE.txt
|
96
95
|
- README.md
|
97
96
|
- Rakefile
|
98
|
-
- bin/console
|
99
|
-
- bin/setup
|
100
97
|
- example/Gemfile
|
101
98
|
- example/config.ru
|
102
99
|
- lib/omniauth-nctu.rb
|
data/.rspec
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "omniauth/nctu"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|