omniauth-myob-adfs-oauth 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 956e03a5a0eb0e454b735c52347ba3ff5623de64
4
- data.tar.gz: 90619dedc7f915c86fdcb138061d3907adb0b85c
3
+ metadata.gz: a990d415091168a11e0040ee329ec584a45033a7
4
+ data.tar.gz: 872563094f315267ff1034a9419802deba8ba41f
5
5
  SHA512:
6
- metadata.gz: 707346e96530122a1643c1a3cda644ba04fc13aa69d5613b9a9ab9bb42ccfdbf1790663d7511b4ca96e167fa88e7c03ad1691b67db5b1dafdb41cf3136375dd8
7
- data.tar.gz: 5af605dd09317a38069d2130f413850f0f445bb945ae16e51a5c674e98124101aa32848c95263d14e66a47611a2a5d1f6ab507d2998de23b43c4b8a7808ea1ac
6
+ metadata.gz: 2c90820374d69d561fb8da50ec536fba8ff1c0a20edb80a0830d836073874755e186ff8c4bcb948ba1e66d30d4a5cc359f955549d590f836ecebba950687f7d4
7
+ data.tar.gz: 68f10f0cddf7e41f43e3e2d8f8236b7ff1ddac84f9eb6a39311a3322b2330881ff5c5aaee800c5d551b2d9d76c44a8e1e0b1de6a3ce7c7e195c48ddc336e2015
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth_myob_oauth2.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Haiyang (harry) Gao
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,70 @@
1
+ # OmniauthMyobOauth2
2
+
3
+ Strategy to authenticate with MYOB via ADFS OAuth2 in OmniAuth.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'omniauth-myob-adfs-oauth2'
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+
15
+ ## Usage
16
+
17
+ Here's an example for adding the middleware to a Rails app in config/initializers/omniauth.rb:
18
+ ```
19
+ Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :myob_adfs_oauth2, your_client_id, your_client_secret
21
+ end
22
+ ```
23
+
24
+ ## Configuration
25
+
26
+ You can configure several options, which you pass in to the provider method via a hash:
27
+
28
+ ```ruby
29
+ Rails.application.config.middleware.use OmniAuth::Builder do
30
+ provider :myob_oauth2, your_client_id, your_client_secret,
31
+ {
32
+ client_options: { site: 'https://test.secure.myob.com' }, #set the target site to SIT
33
+ scope: 'mydot.assets' #set the scope you want
34
+ }
35
+ end
36
+ ```
37
+
38
+
39
+ ## Auth Hash
40
+ Here's an example of an authentication hash available in the callback by accessing request.env["omniauth.auth"]:
41
+ ```ruby
42
+ {
43
+ "provider"=>"myob_oauth2",
44
+ "uid"=>"ab359535-7be6-49a2-b9fd-xxxxxxx",
45
+ "info"=>{
46
+ "email"=>"test@my.com",
47
+ "name"=>"test@my.com"
48
+ },
49
+ "credentials"=>{
50
+ "token"=>"a token",
51
+ "refresh_token"=>"a refresh token,
52
+ "expires_at"=>1406161910,
53
+ "expires"=>true
54
+ },
55
+ "extra"=>{
56
+ "raw_info"=>{
57
+ "uid"=>"ab359535-7be6-49a2-b9fd-db65af2e22e7",
58
+ "username"=>"vidya@my.com"}
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## Contributing
65
+
66
+ 1. Fork it
67
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
68
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
69
+ 4. Push to the branch (`git push origin my-new-feature`)
70
+ 5. Create new Pull Request
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ require File.join('bundler', 'gem_tasks')
3
+ require File.join('rspec', 'core', 'rake_task')
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1 @@
1
+ require File.join('omniauth', 'myob_adfs_oauth')
@@ -0,0 +1 @@
1
+ require File.join('omniauth', 'strategies', 'myob_adfs_oauth')
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module MyobAdfsOauth
3
+ VERSION = "0.0.3"
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class MyobAdfsOauth < OmniAuth::Strategies::OAuth2
6
+
7
+ option :name, 'myob_adfs_oauth'
8
+
9
+ option :scope, 'email'
10
+ option :token_method, :post
11
+ option :resource, 'http://localhost:3000/support'
12
+
13
+ option :client_options, {
14
+ :site => 'https://adfs.myob.com.au',
15
+ :authorize_url => '/adfs/oauth2/authorize',
16
+ :token_url => 'adfs/oauth2/token',
17
+ }
18
+
19
+ option :authorize_options, [:resource]
20
+
21
+ uid { raw_info['uid'] }
22
+
23
+ info do
24
+ {
25
+ :email => raw_info['username']
26
+ }
27
+ end
28
+
29
+ extra do
30
+ {
31
+ 'raw_info' => raw_info
32
+ }
33
+ end
34
+
35
+ def raw_info
36
+ @raw_info ||= access_token['user']
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ require File.expand_path(File.join('..', 'lib', 'omniauth', 'myob_adfs_oauth', 'version'), __FILE__)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.add_dependency 'omniauth', '> 1.0'
6
+
7
+ spec.name = "omniauth-myob-adfs-oauth"
8
+ spec.version = OmniAuth::MyobAdfsOauth::VERSION
9
+ spec.authors = ["Haiyang (harry) Gao"]
10
+ spec.email = ["foxgaocn@gmail.com"]
11
+ spec.description = %q{A MYOB Adfs OAuth2 strategy for OmniAuth 1.x}
12
+ spec.summary = %q{A MYOB Adfs OAuth2 strategy for OmniAuth 1.x}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ spec.files = `git ls-files`.split("\n")
18
+ spec.test_files = `git ls-files -- {spec}/*`.split("\n")
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
22
+ spec.add_development_dependency "rake"
23
+
24
+
25
+ spec.add_development_dependency 'rspec', '>= 2.14.0'
26
+
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-myob-adfs-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Haiyang (harry) Gao
@@ -72,7 +72,17 @@ email:
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
- files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/omniauth-myob-adfs-oauth.rb
82
+ - lib/omniauth/myob_adfs_oauth.rb
83
+ - lib/omniauth/myob_adfs_oauth/version.rb
84
+ - lib/omniauth/strategies/myob_adfs_oauth.rb
85
+ - omniauth-myob-adfs-oauth.gemspec
76
86
  homepage: ''
77
87
  licenses:
78
88
  - MIT