omniauth-onshape-oauth2 0.1.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: 54acc29037b2694a78d9e4a9c147217d0cb08b56
4
+ data.tar.gz: efc848d540a96e71659f52c6c7b79e411addd29e
5
+ SHA512:
6
+ metadata.gz: f6e50683202120b8a8a8f9138497db13899ff016b854ac00fe423451c1ebeece68ee32d1c8c9125e3c930bcfd4be381639edb9b03bd9e6105c54678f889e3f10
7
+ data.tar.gz: 151b2ad36db91da7a4b2ac848e8140e59bcf43e8a2e897376e5e860b7319bbca59edd679070038e936a9a67ed5541a17552ef08a95ee4225d215a2db4075ff19
data/.gitignore ADDED
@@ -0,0 +1,19 @@
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
18
+ .ruby-gemset
19
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mathquill_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,25 @@
1
+ Mathquill License:
2
+ The Source Code Form of MathQuill is subject to the terms of the Mozilla Public License, v. 2.0: http://mozilla.org/MPL/2.0/
3
+
4
+ Copyright (c) 2014 Brentan Alexander Consulting LLC
5
+
6
+ MIT License
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining
9
+ a copy of this software and associated documentation files (the
10
+ "Software"), to deal in the Software without restriction, including
11
+ without limitation the rights to use, copy, modify, merge, publish,
12
+ distribute, sublicense, and/or sell copies of the Software, and to
13
+ permit persons to whom the Software is furnished to do so, subject to
14
+ the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # OmniAuth onShape OAuth2 Strategy
2
+
3
+ A onShape OAuth2 strategy for OmniAuth.
4
+
5
+ For more details, read the onShape documentation: (currently requires private API access to partner server)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'omniauth-onshape-oauth2'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-onshape-oauth2
20
+
21
+ ## Usage
22
+
23
+ Register your application with onShape to receive an API key: https://dev-portal.dev.onshape.com
24
+
25
+ This is an example that you might put into a Rails initializer at `config/initializers/omniauth.rb`:
26
+
27
+ ```ruby
28
+ Rails.application.config.middleware.use OmniAuth::Builder do
29
+ provider :onshape, ENV['ONSHAPE_KEY'], ENV['ONSHAPE_SECRET']
30
+ end
31
+ ```
32
+ You can now access the OmniAuth onShape OAuth2 URL: `/auth/onshape`.
33
+
34
+ You can also utilize the partner dev server, which has a different strategy, using the provider name :onshape_dev and URL /auth/onshape_dev
35
+
36
+ ## Granting Member Permissions to Your Application
37
+
38
+ With the onShape API, you have the ability to specify which permissions you want users to grant your application.
39
+
40
+ By default, omniauth-onshape-oauth2 requests the default permissions registered with your app.
41
+
42
+ You can configure the scope option:
43
+
44
+ ```ruby
45
+ provider :onshape, ENV['ONSHAPE_KEY'], ENV['ONSHAPE_SECRET'], :scope => 'r_emailaddress'
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,57 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class onShape < OmniAuth::Strategies::OAuth2
6
+ # Give your strategy a name.
7
+ option :name, 'onshape_dev'
8
+
9
+ # This is where you pass the options you would pass when
10
+ # initializing your consumer from the OAuth gem.
11
+ option :client_options, {
12
+ :site => 'https://dev-portal.dev.onshape.com',
13
+ :authorize_url => 'https://partner.dev.onshape.com/oauth/authorize',
14
+ :token_url => 'https://partner.dev.onshape.com/oauth/token'
15
+ }
16
+
17
+ # option :scope, 'r_basicprofile r_emailaddress'
18
+ # option :fields, ['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url']
19
+
20
+ # These are called after authentication has succeeded. If
21
+ # possible, you should try to set the UID without making
22
+ # additional calls (if the user id is returned with the token
23
+ # or as a URI parameter). This may not be possible with all
24
+ # providers.
25
+ uid { raw_info['id'] }
26
+
27
+ info do
28
+ {
29
+ :name => raw_info['name'],
30
+ :email => raw_info['email']
31
+ }
32
+ end
33
+
34
+ extra do
35
+ { 'raw_info' => raw_info }
36
+ end
37
+
38
+ alias :oauth2_access_token :access_token
39
+
40
+ #def access_token
41
+ # ::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
42
+ # :mode => :query,
43
+ # :param_name => 'oauth2_access_token',
44
+ # :expires_in => oauth2_access_token.expires_in,
45
+ # :expires_at => oauth2_access_token.expires_at
46
+ # })
47
+ #end
48
+
49
+ def raw_info
50
+ @raw_info ||= access_token.get("/v1/people/~:(#{option_fields.join(',')})?format=json").parsed
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+
57
+ OmniAuth.config.add_camelization 'onshape', 'onShape'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module OnShapeOAuth2
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-onshape-oauth2/version"
2
+ require "omniauth/strategies/onshape"
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth-onshape-oauth2/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "omniauth-onshape-oauth2"
8
+ gem.version = OmniAuth::OnShapeOAuth2::VERSION
9
+ gem.authors = ["Brentan Alexander"]
10
+ gem.email = ["brentan@swiftcalcs.com"]
11
+ gem.summary = %q{A onShape OAuth2 stategy for OmniAuth.}
12
+ gem.description = %q{A onShape OAuth2 stategy for OmniAuth.}
13
+ gem.homepage = "https://www.github.com/brentan/omniauth-onshape-oauth2"
14
+ gem.license = "MIT"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_runtime_dependency 'omniauth', '~> 1.0'
22
+ gem.add_runtime_dependency 'omniauth-oauth2'
23
+
24
+ gem.add_development_dependency 'bundler', '~> 1.3'
25
+ gem.add_development_dependency 'rake'
26
+
27
+ gem.add_development_dependency 'rspec', '~> 2.14.1'
28
+ gem.add_development_dependency 'simplecov'
29
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-onshape-oauth2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brentan Alexander
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-18 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: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
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: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.1
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
+ description: A onShape OAuth2 stategy for OmniAuth.
98
+ email:
99
+ - brentan@swiftcalcs.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .travis.yml
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - lib/omniauth-onshape-oauth2.rb
112
+ - lib/omniauth-onshape-oauth2/version.rb
113
+ - lib/omniauth/strategies/onshape.rb
114
+ - omniauth-onshape-oauth2.gemspec
115
+ homepage: https://www.github.com/brentan/omniauth-onshape-oauth2
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.0.14
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: A onShape OAuth2 stategy for OmniAuth.
139
+ test_files: []