omniauth-txssc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/License +22 -0
- data/Rakefile +3 -0
- data/Readme.md +37 -0
- data/lib/omniauth-txssc.rb +2 -0
- data/lib/omniauth-txssc/version.rb +5 -0
- data/lib/omniauth/strategies/txssc.rb +42 -0
- data/omniauth-txssc.gemspec +20 -0
- metadata +86 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/License
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TxSSC
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/Readme.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Omniauth::TxSSC
|
2
|
+
> OmniAuth Strategy for the TxSSC SSO
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```shell
|
9
|
+
gem 'omniauth-txssc'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
```shell
|
15
|
+
bundle
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
#### Sinatra
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
use OmniAuth::Builder do
|
24
|
+
provider :txssc, ENV['TXSSC_KEY'], ENV['TXSSC_SECRET']
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
#### Rails
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
32
|
+
provider :txssc, ENV['TXSSC_KEY'], ENV['TXSSC_SECRET']
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
## License (MIT)
|
37
|
+
Copyright (c) 2013 TxSSC
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
|
6
|
+
#
|
7
|
+
# Authenticate with the TxSSC SSO
|
8
|
+
#
|
9
|
+
|
10
|
+
class TxSSC < OmniAuth::Strategies::OAuth2
|
11
|
+
|
12
|
+
option :name, 'txssc'
|
13
|
+
|
14
|
+
option :client_options, {
|
15
|
+
:site => 'https://sso.txssc.txstate.edu',
|
16
|
+
:authorize_url => 'https://sso.txssc.txstate.edu/oauth2/authorize',
|
17
|
+
:token_url => 'https://sso.txssc.txstate.edu/oauth2/access_token'
|
18
|
+
}
|
19
|
+
|
20
|
+
uid { raw_info['id'] }
|
21
|
+
|
22
|
+
info do
|
23
|
+
{
|
24
|
+
'name' => raw_info['name'],
|
25
|
+
'username' => raw_info['username'],
|
26
|
+
'email' => raw_info['email'],
|
27
|
+
'role' => raw_info['role'],
|
28
|
+
'avatar' => raw_info['avatar']
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def raw_info
|
33
|
+
access_token.options[:mode] = :query
|
34
|
+
access_token.options[:param_name] = :access_token
|
35
|
+
@raw_info ||= access_token.get('/me').parsed
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
OmniAuth.config.add_camelization('txssc', 'TxSSC')
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../lib/omniauth-txssc/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.add_dependency 'omniauth', '~> 1.1.4'
|
5
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1.1'
|
6
|
+
|
7
|
+
gem.authors = ["vanetix"]
|
8
|
+
gem.email = ["matmcfarland@gmail.com"]
|
9
|
+
gem.description = "Provides an OmniAuth strategy for the TxSSC OAuth2 SSO"
|
10
|
+
gem.summary = "An OmniAuth strategy for TxSSC"
|
11
|
+
gem.homepage = ""
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.name = "omniauth-txssc"
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
gem.version = Omniauth::TxSSC::VERSION
|
19
|
+
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-txssc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- vanetix
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.4
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: omniauth-oauth2
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.1
|
46
|
+
description: Provides an OmniAuth strategy for the TxSSC OAuth2 SSO
|
47
|
+
email:
|
48
|
+
- matmcfarland@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
55
|
+
- License
|
56
|
+
- Rakefile
|
57
|
+
- Readme.md
|
58
|
+
- lib/omniauth-txssc.rb
|
59
|
+
- lib/omniauth-txssc/version.rb
|
60
|
+
- lib/omniauth/strategies/txssc.rb
|
61
|
+
- omniauth-txssc.gemspec
|
62
|
+
homepage: ''
|
63
|
+
licenses: []
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.8.23
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: An OmniAuth strategy for TxSSC
|
86
|
+
test_files: []
|