omniauth-msunet 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a21a6b4d182d5f9129a14cef0496abed047b0108
4
+ data.tar.gz: de5580ca752046186002776b60efc97defaa5934
5
+ SHA512:
6
+ metadata.gz: 5b0461aa0b26b2ae14afdc6d19e273a09f97514853c2297164258f985d53a65b7b1af6e7c4a7bd867d282c4709da345bfeaaa7b8e09d20471ce1e662fa3a54c3
7
+ data.tar.gz: d59b7537dec540d090b75d070c71f046730ee34672de23b1e0d6e4bcce031e7fd515335248a632c3e9e7848150ec4ca52e618f57301f874be96b7f3065295e9d
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ /pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ ### 1.0.0
2
+
3
+ Bug fixes
4
+
5
+ None
6
+
7
+ Enhancements
8
+
9
+ None
10
+
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-msunet.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+ gem 'guard-bundler'
10
+ gem 'rb-fsevent'
11
+ gem 'growl'
12
+ end
data/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ COPYRIGHT © 2013
2
+ MICHIGAN STATE UNIVERSTIY BOARD OF TRUSTEES
3
+ ALL RIGHTS RESERVED
4
+
5
+ PERMISSION IS GRANTED TO USE, COPY AND REDISTRIBUTE THIS SOFTWARE FOR NONCOMMERCIAL EDUCATION AND RESEARCH PURPOSES, SO LONG AS NO FEE IS CHARGED, AND SO LONG AS THE COPYRIGHT NOTICE ABOVE, THIS GRANT OF PERMISSION, AND THE DISCLAIMER BELOW APPEAR IN ALL COPIES MADE; AND SO LONG AS THE NAME OF MICHIGAN STATE UNIVERSITY IS NOT USED IN ANY ADVERTISING OR PUBLICITY PERTAINING TO THE USE OR DISTRIBUTION OF THIS SOFTWARE WITHOUT SPECIFIC, WRITTEN PRIOR AUTHORIZATION. PERMISSION TO MODIFY OR OTHERWISE CREATE DERIVATIVE WORKS OF THIS SOFTWARE IS NOT GRANTED.
6
+
7
+ THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION AS TO ITS FITNESS FOR ANY PURPOSE, AND WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE MICHIGAN STATE UNIVERSITY BOARD OF TRUSTEES SHALL NOT BE LIABLE FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # OmniAuth MSUnet
2
+
3
+ This is the official OmniAuth strategy gem for authenticating to [Michigan State University](http://www.msu.edu) MSUnet using OAuth2. To use this gem you'll need the following:
4
+
5
+ * Contact MSU IT Services at 517-432-6200 to request to register your application.
6
+ * Provide IT Services with a callback URL, which is where to send successful MSUnet authentication requests back to your application. Note: this must be a HTTPS address.
7
+ * Receive a `client_id` token and `client_secret` token specific for your application.
8
+
9
+ ## Installation
10
+
11
+ To install this gem you need to add it to your Gemfile as follows:
12
+ ```gem 'omniauth-msunet', :git => 'https://gitlab.msu.edu/tm/omniauth-msunet.git'```
13
+
14
+ ## Basic Usage
15
+
16
+ If this is your applications first OmniAuth strategy then you will need to create the file config/initializers/omniauth.rb, otherwise update your existing one.
17
+
18
+ ```
19
+ Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :msunet, "replace_with_client_id", "replace_with_client_secret"
21
+ end
22
+ ```
23
+
24
+ Next you need to setup some routes to handle the callback and if it's a success or failure. You could use something like the following in your config/routes.rb file
25
+
26
+ ```
27
+ match 'auth/:provider/callback', to: 'sessions#create'
28
+ match 'auth/failure', to: redirect('/')
29
+ match 'signout', to: 'sessions#destroy', as: 'signout'
30
+ ```
31
+
32
+ Finally restart your server for all of the changes to take effect. You can now browse to your apps URL `https://0.0.0.0/auth/msunet` to login.
33
+
34
+ Once the login is completed you should receive the following hash that you can access:
35
+
36
+ ```
37
+ {
38
+ "provider":"msunet",
39
+ "uid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
40
+ "info":{
41
+ "name":"John Sparty",
42
+ "email":"sparty@msu.edu",
43
+ "first_name":"John",
44
+ "last_name":"Sparty",
45
+ "description":"MSUNet OAuth2 Auth-n"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## License
51
+
52
+ Please see the LICENSE.md file.
@@ -0,0 +1,3 @@
1
+ require 'omniauth-oauth2'
2
+ require 'omniauth-msunet/version'
3
+ require 'omniauth/strategies/msunet'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module MSUnet
3
+ VERSION = "0.5.0"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class MSUnet < OmniAuth::Strategies::OAuth2
7
+ option :client_options, {
8
+ site: "https://oauth.dev.ais.msu.edu",
9
+ authorize_path: "/oauth/authorize",
10
+ authorize_url: "/oauth/authorize",
11
+ token_url: "/oauth/token"
12
+ }
13
+
14
+ uid do
15
+ raw_info['uid'].to_s
16
+ end
17
+
18
+ info do
19
+ {
20
+ name: raw_info['info']['name'].to_s || raw_info['name'].to_s,
21
+ first_name: raw_info['info']['first_name'].to_s || raw_info['first_name'].to_s,
22
+ last_name: raw_info['info']['last_name'].to_s || raw_info['last_name'].to_s,
23
+ email: raw_info['info']['email'].to_s || raw_info['email'].to_s,
24
+ netid: raw_info['info']['email'].to_s || raw_info['email'].to_s
25
+ }
26
+ end
27
+
28
+ extra do
29
+ { :raw_info => raw_info }
30
+ end
31
+
32
+ def raw_info
33
+ @raw_info ||= MultiJson.load(access_token.get("/oauth/me?access_token=#{access_token.token}").body)
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+
40
+ OmniAuth.config.add_camelization 'msunet', 'MSUnet'
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-msunet/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Troy Murray"]
6
+ gem.email = ["tm@msu.edu"]
7
+ gem.summary = %q{Michigan State University MSUnet OmniAuth strategy.}
8
+ gem.description = %q{Official OmniAuth strategy for authenticating against the Michigan State University MSUnet OAuth2 provider.}
9
+ gem.homepage = "https://gitlab.msu.edu/msu-middleware-group/omniauth-msunet"
10
+ gem.license = 'MSU'
11
+
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.name = "omniauth-msunet"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = OmniAuth::MSUnet::VERSION
18
+
19
+ gem.add_dependency 'omniauth', '~> 1.1'
20
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1'
21
+ gem.add_dependency 'multi_json', '~> 1.7'
22
+ gem.add_development_dependency 'rspec', '~> 2.7'
23
+ gem.add_development_dependency 'rack-test'
24
+ gem.add_development_dependency 'simplecov'
25
+ gem.add_development_dependency 'webmock'
26
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-msunet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Troy Murray
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Official OmniAuth strategy for authenticating against the Michigan State
112
+ University MSUnet OAuth2 provider.
113
+ email:
114
+ - tm@msu.edu
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - CHANGELOG.md
121
+ - Gemfile
122
+ - LICENSE.md
123
+ - README.md
124
+ - lib/omniauth-msunet.rb
125
+ - lib/omniauth-msunet/version.rb
126
+ - lib/omniauth/strategies/msunet.rb
127
+ - omniauth-msunet.gemspec
128
+ homepage: https://gitlab.msu.edu/msu-middleware-group/omniauth-msunet
129
+ licenses:
130
+ - MSU
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.0.6
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Michigan State University MSUnet OmniAuth strategy.
152
+ test_files: []