omniauth-layervault 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 91e32a69c638b2392a81b2bcb15c6d85f5e3f9e2
4
+ data.tar.gz: 159fd98ac8f3a91ebeef814519f6484954af7ea8
5
+ SHA512:
6
+ metadata.gz: f92d20ebc57ee282b03a5f6193b271e43cee67cf5986e247461519539515b849116856ae9ea1e7f1fb5c0babb33774ece54fe8d5c5402bbe4243c131b923c524
7
+ data.tar.gz: 4b10d66a42a3ef2d043b8814b32f3ac82ba79ad0440173a47cd644fd60cb4cd1d58cabaf5819654f6a462d14f6ade6dd5adaded6c042ccf6feaf8e1099a971f3
@@ -0,0 +1,18 @@
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
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-layervault.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ryan LeFevre
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.
@@ -0,0 +1,55 @@
1
+ # OmniAuth LayerVault
2
+
3
+ Official OmniAuth strategy for authenticating with LayerVault. You will need to [register your application](https://layervault.com/oauth/applications/new) first.
4
+
5
+ ## Installation
6
+
7
+ Install the gem or add it to your Gemfile.
8
+
9
+ ```
10
+ gem install omniauth-layervault
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ You will need to configure the strategy as middleware.
16
+
17
+ **Rack**
18
+
19
+ ``` ruby
20
+ use OmniAuth::Builder do
21
+ provider :layervault, ENV['LAYERVAULT_KEY'], ENV['LAYERVAULT_SECRET']
22
+ end
23
+ ```
24
+
25
+ **Rails 3**
26
+
27
+ ``` ruby
28
+ Rails.application.config.middleware use OmniAuth::Builder do
29
+ provider :layervault, ENV['LAYERVAULT_KEY'], ENV['LAYERVAULT_SECRET']
30
+ end
31
+ ```
32
+
33
+ ### Scopes
34
+
35
+ LayerVault supports various scopes to limit what actions your application can perform with the API. To specify which scopes to use:
36
+
37
+ ``` ruby
38
+ use OmniAuth::Builder do
39
+ provider :layervault, ENV['LAYERVAULT_KEY'], ENV['LAYERVAULT_SECRET'], scope: "user+files"
40
+ end
41
+ ```
42
+
43
+ **Available Scopes**
44
+
45
+ * user: default, basic user information
46
+ * files: read access to the user's files and folders
47
+ * write: write access to the user's files and folders
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ require "omniauth-layervault/version"
2
+ require "omniauth/strategies/layervault"
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module LayerVault
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class LayerVault < OmniAuth::Strategies::OAuth2
6
+ option :name, :layervault
7
+
8
+ option :client_options, {
9
+ :site => "https://layervault.com",
10
+ :authorize_url => "/oauth/authorize"
11
+ }
12
+
13
+ uid { raw_info["id"].to_s }
14
+
15
+ info do
16
+ {
17
+ email: raw_info["email"],
18
+ first_name: raw_info["first_name"],
19
+ last_name: raw_info["last_name"],
20
+ is_admin: raw_info['is_admin']
21
+ }
22
+ end
23
+
24
+ def raw_info
25
+ @raw_info ||= access_token.get('/me.json').parsed['user']
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ OmniAuth.config.add_camelization 'layervault', 'LayerVault'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth-layervault/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "omniauth-layervault"
8
+ gem.version = OmniAuth::LayerVault::VERSION
9
+ gem.authors = ["Ryan LeFevre"]
10
+ gem.email = ["ryan@layervault.com"]
11
+ gem.description = %q{Official OmniAuth strategy for LayerVault}
12
+ gem.summary = %q{Official OmniAuth strategy for LayerVault}
13
+ gem.homepage = "https://github.com/layervault/omniauth-layervault"
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_dependency 'omniauth', '~> 1.0'
22
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1'
23
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-layervault
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan LeFevre
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-16 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'
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
+ description: Official OmniAuth strategy for LayerVault
42
+ email:
43
+ - ryan@layervault.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/omniauth-layervault.rb
54
+ - lib/omniauth-layervault/version.rb
55
+ - lib/omniauth/strategies/layervault.rb
56
+ - omniauth-layervault.gemspec
57
+ homepage: https://github.com/layervault/omniauth-layervault
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.0.3
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Official OmniAuth strategy for LayerVault
81
+ test_files: []