omniauth-alicloud 1.0.1

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
+ SHA256:
3
+ metadata.gz: d967a83b20e824dc7bbd970408572ea8481c6186ff48dd2b706c8784538d44ac
4
+ data.tar.gz: 22302082cfd04e20f624855cbef0a020bdf2c1d30d288336bd6816c196b11877
5
+ SHA512:
6
+ metadata.gz: cf3e9303f00d9599785577659cb96801991b7fad402cf99954179388f7c0072723d3c42284020bc720b811b0970fd6f2e7212e64fe37dbf2e85fc44b32a90009
7
+ data.tar.gz: 2fdb5c930f70f99aec5a80c50cf506095baa58185d8ee72c274375aa1b69da9072abbb9ee83a3c047dc010d1f392f3085112d5fba806f91832fb23d7e62b6018
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_WITHOUT: "production"
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .rspec_status
2
+ omniauth-alicloud-*.gem
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "byebug"
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-alicloud (1.0.1)
5
+ omniauth-oauth2 (~> 1.7.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ byebug (11.1.3)
11
+ diff-lcs (1.5.0)
12
+ faraday (2.2.0)
13
+ faraday-net_http (~> 2.0)
14
+ ruby2_keywords (>= 0.0.4)
15
+ faraday-net_http (2.0.1)
16
+ hashie (5.0.0)
17
+ jwt (2.3.0)
18
+ multi_json (1.15.0)
19
+ multi_xml (0.6.0)
20
+ oauth2 (1.4.9)
21
+ faraday (>= 0.17.3, < 3.0)
22
+ jwt (>= 1.0, < 3.0)
23
+ multi_json (~> 1.3)
24
+ multi_xml (~> 0.5)
25
+ rack (>= 1.2, < 3)
26
+ omniauth (2.0.4)
27
+ hashie (>= 3.4.6)
28
+ rack (>= 1.6.2, < 3)
29
+ rack-protection
30
+ omniauth-oauth2 (1.7.2)
31
+ oauth2 (~> 1.4)
32
+ omniauth (>= 1.9, < 3)
33
+ rack (2.2.3)
34
+ rack-protection (2.2.0)
35
+ rack
36
+ rake (12.3.3)
37
+ rspec (3.11.0)
38
+ rspec-core (~> 3.11.0)
39
+ rspec-expectations (~> 3.11.0)
40
+ rspec-mocks (~> 3.11.0)
41
+ rspec-core (3.11.0)
42
+ rspec-support (~> 3.11.0)
43
+ rspec-expectations (3.11.0)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.11.0)
46
+ rspec-mocks (3.11.0)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.11.0)
49
+ rspec-support (3.11.0)
50
+ ruby2_keywords (0.0.5)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ byebug
57
+ omniauth-alicloud!
58
+ rake (~> 12.0)
59
+ rspec (~> 3.0)
60
+
61
+ BUNDLED WITH
62
+ 2.2.31
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 jimcheung
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Omniauth AliCloud
2
+
3
+ To use it, you'll need to sign up for an OAuth2 Application ID and Secret on the [Alicloud Oauth Applications Page](https://ram.console.aliyun.com/applications).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-alicloud'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```
16
+ $ bundle install
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ `OmniAuth::Strategies::Alicloud` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
22
+
23
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
27
+ provider :alicloud, ENV['ALICLOUD_APP_SECRET_ID'], ENV['ALICLOUD_APP_SECRET_KEY']
28
+ end
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Alicloud < OmniAuth::Strategies::OAuth2
6
+ option :name, 'alicloud'
7
+
8
+ option :client_options, {
9
+ :site => 'https://oauth.aliyun.com/',
10
+ :authorize_url => 'https://signin.aliyun.com/oauth2/v1/auth',
11
+ :token_url => 'https://oauth.aliyun.com/v1/token'
12
+ }
13
+
14
+ uid do
15
+ raw_info['uid']
16
+ end
17
+
18
+ info do
19
+ {
20
+ name: raw_info['name'],
21
+ email: raw_info['login_name'] || raw_info['upn'],
22
+ username: raw_info['name'],
23
+ sub: raw_info['sub'],
24
+ aid: raw_info['aid'],
25
+ uid: raw_info['uid']
26
+ }
27
+ end
28
+
29
+ extra do
30
+ { raw_info: raw_info }
31
+ end
32
+
33
+ protected
34
+
35
+ def raw_info
36
+ @raw_info ||= access_token.get('/v1/userinfo').parsed || {}
37
+ end
38
+
39
+ def callback_url
40
+ full_host + script_name + callback_path
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ OmniAuth.config.add_camelization 'alicloud', 'Alicloud'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Alicloud
5
+ VERSION = '1.0.1'
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-oauth2'
4
+ require 'omniauth-alicloud/version'
5
+ require 'omniauth/strategies/alicloud'
@@ -0,0 +1,27 @@
1
+ require_relative 'lib/omniauth-alicloud/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "omniauth-alicloud"
5
+ spec.version = OmniAuth::Alicloud::VERSION
6
+ spec.authors = ["JiHu(GitLab)"]
7
+ spec.email = ["dev@jihulab.com"]
8
+
9
+ spec.summary = %q{Omniauth strategy for AliCloud}
10
+ spec.description = %q{Wrapper the AliCloud Oauth2 API}
11
+ spec.homepage = "https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud"
12
+ spec.license = "MIT"
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = "https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency 'omniauth-oauth2', '~> 1.7.1'
27
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-alicloud
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - JiHu(GitLab)
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.7.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.7.1
27
+ description: Wrapper the AliCloud Oauth2 API
28
+ email:
29
+ - dev@jihulab.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".bundle/config"
35
+ - ".gitignore"
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - lib/omniauth-alicloud.rb
42
+ - lib/omniauth-alicloud/version.rb
43
+ - lib/omniauth/strategies/alicloud.rb
44
+ - omniauth-alicloud.gemspec
45
+ homepage: https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud
46
+ licenses:
47
+ - MIT
48
+ metadata:
49
+ homepage_uri: https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud
50
+ source_code_uri: https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 3.2.22
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Omniauth strategy for AliCloud
70
+ test_files: []