omniauth-vsts 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +12 -0
- data/LICENSE +21 -0
- data/Readme.md +55 -0
- data/lib/omniauth-vsts.rb +2 -0
- data/lib/omniauth-vsts/version.rb +5 -0
- data/lib/omniauth/strategies/vsts.rb +62 -0
- data/omniauth-vsts.gemspec +28 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bfdb624c7f6e5205a1b065c618a62d064e3688f6
|
4
|
+
data.tar.gz: 861ba27157017afbfab5b3f827efaf7079fde888
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f2b045c4461a0e5275b6a61fc4e52b849d077e2f1a932776bd5fbf079cce74885e2a5496de2b62f1e3b6b92d855a488742ad05c1991d68ae45862b22120c8c98
|
7
|
+
data.tar.gz: f2c8d9a0e9e72af9dbf35ebb6c425050d3c6943d1b54de8924b3f8e1c28123d4897692b799f2cb7bf935857c9e392f9a6b81b43e3573787d6031e69094d3d282
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Barnabas Birmacher
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/Readme.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# OmniAuth VSTS
|
2
|
+
|
3
|
+
This is the OmniAuth strategy for authenticating to [VSTS](https://app.vsaex.visualstudio.com).
|
4
|
+
To use it, you'll need to signup for an OAuth2 Application ID and Secret on the VSTS Application Page.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
Add dependency to your Gemfile:
|
9
|
+
|
10
|
+
```
|
11
|
+
gem 'omniauth-vsts'
|
12
|
+
```
|
13
|
+
|
14
|
+
Or install manually:
|
15
|
+
|
16
|
+
```
|
17
|
+
gem install omniauth-vsts
|
18
|
+
```
|
19
|
+
|
20
|
+
## Basic Usage
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
use OmniAuth::Builder do
|
24
|
+
provider :vsts, ENV['VSTS_APP_ID'], ENV['VSTS_APP_SECRET'], :scope => 'scopes'
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
If using Rails, add an initializer `config/initializers/omniauth.rb`:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
32
|
+
provider :vsts, 'VSTS_APP_ID', 'VSTS_APP_SECRET', :scope => 'scopes'
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
Copyright (c) 2016 Barnabas Birmacher.
|
39
|
+
|
40
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
41
|
+
this software and associated documentation files (the "Software"), to deal in
|
42
|
+
the Software without restriction, including without limitation the rights to
|
43
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
44
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
45
|
+
subject to the following conditions:
|
46
|
+
|
47
|
+
The above copyright notice and this permission notice shall be included in all
|
48
|
+
copies or substantial portions of the Software.
|
49
|
+
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
51
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
52
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
53
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
54
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
55
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class VSTS < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, 'vsts'
|
7
|
+
option :authorize_params, {:response_type => 'Assertion'}
|
8
|
+
option :token_params, {
|
9
|
+
:client_assertion_type => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
|
10
|
+
:client_assertion => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im9PdmN6NU1fN3AtSGpJS2xGWHo5M3VfVjBabyJ9.eyJjaWQiOiJjZmI4N2U1MS00NGJlLTRlZjEtOWUxNC02OTVlZGZjODFiOTciLCJjc2kiOiIyYzUyMDU2My0zMjhiLTQzMGMtOGUzNy0wN2NhODg2ZjgxOWEiLCJuYW1laWQiOiIyNzk2ZjU2Ni03OWUzLTQ3YmItOTU5Ny1kMzFlYmM5MDU3ZDMiLCJpc3MiOiJhcHAudnNzcHMudmlzdWFsc3R1ZGlvLmNvbSIsImF1ZCI6ImFwcC52c3Nwcy52aXN1YWxzdHVkaW8uY29tIiwibmJmIjoxNDcyMTI4NzEzLCJleHAiOjE2Mjk4OTUxMTN9.dMBpndiMeePFCkZeszncx0_kTjxv5PhhLGwklUZ4Wngtg9v7D30YfRyVERlPfYs76ZC4hgXlmd47Aaw3ZefvIoK6cGfyacpBoQf2df_Ac9qoAgEPyUw_WvgmeBmdsGlJ0Ubs-OOz9-AgESGiuCAABNk1oCDM8AlPlMYprL2Dcz7M0bzS1yIgTYc06YJqJGDoEqkL7Zbgx2wKOb9tMQ92bUq433KhxPW8t43A0dai2jm0XSRzWyxHgiCfyJ9q-J0GHXsNATTuzGAbt8ArkWSQrx7rCIBdKprWpkO8NCpPHp0pJLeAnKxk-ahp4RnuJhLkRU3RKfQBrvHSZl-3Rlis3Q',
|
11
|
+
:grant_type => 'urn:ietf:params:oauth:grant-type:jwt-bearer'
|
12
|
+
}
|
13
|
+
|
14
|
+
option :client_options, {
|
15
|
+
:site => 'https://app.vssps.visualstudio.com',
|
16
|
+
:authorize_url => '/oauth2/authorize',
|
17
|
+
:token_url => '/oauth2/token'
|
18
|
+
}
|
19
|
+
|
20
|
+
def callback_url
|
21
|
+
full_host + script_name + callback_path
|
22
|
+
end
|
23
|
+
|
24
|
+
def authorize_params
|
25
|
+
super.tap do |params|
|
26
|
+
%w[client_options].each do |v|
|
27
|
+
if request.params[v]
|
28
|
+
params[v.to_sym] = request.params[v]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
uid { raw_info['id'].to_s }
|
35
|
+
|
36
|
+
info do
|
37
|
+
{
|
38
|
+
'name' => raw_info['displayName'],
|
39
|
+
'email' => raw_info['emailAddress'],
|
40
|
+
'public_alias' => raw_info['publicAlias']
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
extra do
|
45
|
+
{:raw_info => raw_info }
|
46
|
+
end
|
47
|
+
|
48
|
+
def raw_info
|
49
|
+
@raw_info ||= access_token.get('/_apis/profile/profiles/me?api-version=1.0').parsed
|
50
|
+
end
|
51
|
+
|
52
|
+
protected
|
53
|
+
|
54
|
+
def build_access_token
|
55
|
+
assertion = request.params["code"]
|
56
|
+
client.get_token({:assertion => assertion, :redirect_uri => callback_url}.merge(token_params.to_hash(:symbolize_keys => true)))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
OmniAuth.config.add_camelization 'vsts', 'VSTS'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-vsts/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.authors = ["Barnabas Birmacher"]
|
7
|
+
gem.email = ["birmacher@gmail.com"]
|
8
|
+
gem.description = %q{OmniAuth strategy for VSTS.}
|
9
|
+
gem.summary = %q{OmniAuth strategy for VSTS.}
|
10
|
+
gem.homepage = "https://github.com/birmacher/omniauth-vsts"
|
11
|
+
gem.license = 'MIT'
|
12
|
+
|
13
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.name = "omniauth-vsts"
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
gem.version = OmniAuth::VSTS::VERSION
|
19
|
+
|
20
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
21
|
+
# Nothing lower than omniauth-oauth2 1.1.1
|
22
|
+
# http://www.rubysec.com/advisories/CVE-2012-6134/
|
23
|
+
gem.add_dependency 'omniauth-oauth2', '>= 1.1.1'
|
24
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
25
|
+
gem.add_development_dependency 'rack-test'
|
26
|
+
gem.add_development_dependency 'simplecov'
|
27
|
+
gem.add_development_dependency 'webmock'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-vsts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Barnabas Birmacher
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-26 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.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
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.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.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
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: webmock
|
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
|
+
description: OmniAuth strategy for VSTS.
|
98
|
+
email:
|
99
|
+
- birmacher@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- Readme.md
|
108
|
+
- lib/omniauth-vsts.rb
|
109
|
+
- lib/omniauth-vsts/version.rb
|
110
|
+
- lib/omniauth/strategies/vsts.rb
|
111
|
+
- omniauth-vsts.gemspec
|
112
|
+
homepage: https://github.com/birmacher/omniauth-vsts
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.6.6
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: OmniAuth strategy for VSTS.
|
136
|
+
test_files: []
|