aptible-auth 0.0.1
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/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/README.md +34 -0
- data/Rakefile +4 -0
- data/aptible-auth.gemspec +28 -0
- data/lib/aptible/auth.rb +8 -0
- data/lib/aptible/auth/client.rb +13 -0
- data/lib/aptible/auth/strategy/pubkey.rb +25 -0
- data/lib/aptible/auth/version.rb +5 -0
- data/spec/aptible/auth/client_spec.rb +5 -0
- data/spec/aptible/auth/strategy/pubkey_spec.rb +5 -0
- data/spec/spec_helper.rb +10 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 25bd04db8b8a3727e0f28197c3bfc46e4c11a9e8
|
4
|
+
data.tar.gz: 1f0a678a374ebf27655ff4fc791dd4984dba8af5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86a0ec2af4dec80f3d87da1bf2ad9ac418f2e14ffa1754d691d50361d71ba2c05bd70e473ecc48e290074818f3f3f137cfd0741d96e0f6fa3c1cc97eb9c7f6b8
|
7
|
+
data.tar.gz: c523b0a4b03ee140f74fb3e8b526a2c04b0dce0c871201893de743993a18bce480c36a9c0e1e061f99901ecef69c6498477226460f86ff1d26951f663587fcec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Aptible, Inc.
|
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/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# ![](https://raw.github.com/aptible/straptible/master/lib/straptible/rails/templates/public.api/icon-60px.png) Aptible::Auth
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/aptible-auth.png)](https://rubygems.org/gems/aptible-auth)
|
4
|
+
[![Build Status](https://travis-ci.org/aptible/aptible-auth-ruby.png?branch=master)](https://travis-ci.org/aptible/aptible-auth-ruby)
|
5
|
+
[![Dependency Status](https://gemnasium.com/aptible/aptible-auth-ruby.png)](https://gemnasium.com/aptible/aptible-auth-ruby)
|
6
|
+
|
7
|
+
Ruby client for [auth.aptible.com](https://auth.aptible.com/). Since Aptible's authorization service is built on OAuth 2.0, most developers should be able to implement a client using just the [oauth2](https://github.com/intridea/oauth2) gem.
|
8
|
+
|
9
|
+
However, due to the complexity of OAuth 2.0 and the fact that it is a fragmented and evolving standard, we provide this gem as a standard Ruby client library. All of our internal services use it, and so it can be expected to work.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add the following line to your application's Gemfile.
|
14
|
+
|
15
|
+
gem 'aptible-auth'
|
16
|
+
|
17
|
+
And then run `bundle install`.
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Add usage notes.
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork the project.
|
26
|
+
1. Commit your changes, with specs.
|
27
|
+
1. Ensure that your code passes specs (`rake spec`) and meets Aptible's Ruby style guide (`rake rubocop`).
|
28
|
+
1. Create a new pull request on GitHub.
|
29
|
+
|
30
|
+
## Copyright and License
|
31
|
+
|
32
|
+
MIT License, see [LICENSE](LICENSE.md) for details.
|
33
|
+
|
34
|
+
Copyright (c) 2013 [Aptible](https://www.aptible.com), Frank Macreery, and contributors.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'English'
|
6
|
+
require 'aptible/auth/version'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'aptible-auth'
|
10
|
+
spec.version = Aptible::Auth::VERSION
|
11
|
+
spec.authors = ['Frank Macreery']
|
12
|
+
spec.email = ['frank@macreery.com']
|
13
|
+
spec.description = 'Ruby client for auth.aptible.com'
|
14
|
+
spec.summary = 'Ruby client for auth.aptible.com'
|
15
|
+
spec.homepage = 'https://github.com/aptible/aptible-auth'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($RS)
|
19
|
+
spec.test_files = spec.files.grep(/^spec\//)
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'oauth2'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
spec.add_dependency 'rspec', '~> 2.0'
|
28
|
+
end
|
data/lib/aptible/auth.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'oauth2'
|
2
|
+
require 'aptible/auth/strategy/pubkey'
|
3
|
+
|
4
|
+
module Aptible
|
5
|
+
module Auth
|
6
|
+
class Client < OAuth2::Client
|
7
|
+
# The Pubkey Strategy (Aptible-custom)
|
8
|
+
def pubkey
|
9
|
+
@pubkey ||= Aptible::Auth::Strategy::Pubkey.new(self)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'oauth2'
|
2
|
+
|
3
|
+
module Aptible
|
4
|
+
module Auth
|
5
|
+
module Strategy
|
6
|
+
# The Pubkey Strategy (Aptible-custom)
|
7
|
+
class Pubkey < OAuth2::Strategy::Base
|
8
|
+
# TODO: Implement
|
9
|
+
#
|
10
|
+
# @raise [NotImplementedError]
|
11
|
+
def get_token(fingerprint, params = {}, opts = {})
|
12
|
+
# rubocop:disable UselessAssignment
|
13
|
+
params = {
|
14
|
+
'grant_type' => 'pubkey',
|
15
|
+
'fingerprint' => fingerprint,
|
16
|
+
'password' => password
|
17
|
+
}.merge(client_params).merge(params)
|
18
|
+
# rubocop:enable UselessAssignment
|
19
|
+
|
20
|
+
fail NotImplementedError, 'Strategy not yet implemented'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
# Load shared spec files
|
5
|
+
Dir["#{File.dirname(__FILE__)}/shared/**/*.rb"].each do |file|
|
6
|
+
require file
|
7
|
+
end
|
8
|
+
|
9
|
+
# Require library up front
|
10
|
+
require 'aptible/auth'
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aptible-auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Frank Macreery
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aptible-tasks
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.2.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.2.0
|
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.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
description: Ruby client for auth.aptible.com
|
84
|
+
email:
|
85
|
+
- frank@macreery.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .rspec
|
92
|
+
- .travis.yml
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.md
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- aptible-auth.gemspec
|
98
|
+
- lib/aptible/auth.rb
|
99
|
+
- lib/aptible/auth/client.rb
|
100
|
+
- lib/aptible/auth/strategy/pubkey.rb
|
101
|
+
- lib/aptible/auth/version.rb
|
102
|
+
- spec/aptible/auth/client_spec.rb
|
103
|
+
- spec/aptible/auth/strategy/pubkey_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
homepage: https://github.com/aptible/aptible-auth
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.0.14
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Ruby client for auth.aptible.com
|
129
|
+
test_files:
|
130
|
+
- spec/aptible/auth/client_spec.rb
|
131
|
+
- spec/aptible/auth/strategy/pubkey_spec.rb
|
132
|
+
- spec/spec_helper.rb
|