omniauth-alicloud-3.0.0/0000755000004100000410000000000014543753637015201 5ustar www-datawww-dataomniauth-alicloud-3.0.0/omniauth-alicloud.gemspec0000644000004100000410000000216714543753637022172 0ustar www-datawww-datarequire_relative 'lib/omniauth-alicloud/version' Gem::Specification.new do |spec| spec.name = "omniauth-alicloud" spec.version = OmniAuth::Alicloud::VERSION spec.authors = ["JiHu(GitLab)"] spec.email = ["dev@jihulab.com"] spec.summary = %q{Omniauth strategy for AliCloud} spec.description = %q{Wrapper the AliCloud Oauth2 API} spec.homepage = "https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud" spec.license = "MIT" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } end spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_dependency 'omniauth-oauth2', '~> 1.8' end omniauth-alicloud-3.0.0/Gemfile.lock0000644000004100000410000000255214543753637017427 0ustar www-datawww-dataPATH remote: . specs: omniauth-alicloud (3.0.0) omniauth-oauth2 (~> 1.8) GEM remote: https://rubygems.org/ specs: byebug (11.1.3) diff-lcs (1.5.0) faraday (2.2.0) faraday-net_http (~> 2.0) ruby2_keywords (>= 0.0.4) faraday-net_http (2.0.1) hashie (5.0.0) jwt (2.5.0) multi_xml (0.6.0) oauth2 (2.0.8) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_xml (~> 0.5) rack (>= 1.2, < 3) snaky_hash (~> 2.0) version_gem (~> 1.1) omniauth (2.1.0) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) rack (2.2.4) rack-protection (2.2.2) rack rake (12.3.3) rspec (3.11.0) rspec-core (~> 3.11.0) rspec-expectations (~> 3.11.0) rspec-mocks (~> 3.11.0) rspec-core (3.11.0) rspec-support (~> 3.11.0) rspec-expectations (3.11.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) rspec-support (3.11.1) ruby2_keywords (0.0.5) snaky_hash (2.0.0) hashie version_gem (~> 1.1) version_gem (1.1.0) PLATFORMS ruby DEPENDENCIES byebug omniauth-alicloud! rake (~> 12.0) rspec (~> 3.0) BUNDLED WITH 2.2.31 omniauth-alicloud-3.0.0/.gitlab-ci.yml0000644000004100000410000000134514543753637017640 0ustar www-datawww-datadefault: image: ruby:3.0.5 workflow: rules: # For merge requests, create a pipeline. - if: '$CI_MERGE_REQUEST_IID' # For `main` branch, create a pipeline (this includes on schedules, pushes, merges, etc.). - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # For tags, create a pipeline. - if: '$CI_COMMIT_TAG' .test_template: &test_definition image: ruby:${RUBY_VERSION} stage: test script: - gem install bundler --no-document - bundle config --local path "vendor/bundle" - bundle install - bundle exec rspec cache: key: ${CI_JOB_IMAGE} paths: - apt-cache/ - vendor/ruby ruby: <<: *test_definition parallel: matrix: - RUBY_VERSION: ["3.0", "3.1", "3.2"] omniauth-alicloud-3.0.0/.gitignore0000644000004100000410000000004514543753637017170 0ustar www-datawww-data.rspec_status omniauth-alicloud-*.gemomniauth-alicloud-3.0.0/lib/0000755000004100000410000000000014543753637015747 5ustar www-datawww-dataomniauth-alicloud-3.0.0/lib/omniauth-alicloud/0000755000004100000410000000000014543753637021365 5ustar www-datawww-dataomniauth-alicloud-3.0.0/lib/omniauth-alicloud/version.rb0000644000004100000410000000014114543753637023373 0ustar www-datawww-data# frozen_string_literal: true module OmniAuth module Alicloud VERSION = '3.0.0' end end omniauth-alicloud-3.0.0/lib/omniauth-alicloud.rb0000644000004100000410000000020414543753637021706 0ustar www-datawww-data# frozen_string_literal: true require 'omniauth-oauth2' require 'omniauth-alicloud/version' require 'omniauth/strategies/alicloud' omniauth-alicloud-3.0.0/lib/omniauth/0000755000004100000410000000000014543753637017573 5ustar www-datawww-dataomniauth-alicloud-3.0.0/lib/omniauth/strategies/0000755000004100000410000000000014543753637021745 5ustar www-datawww-dataomniauth-alicloud-3.0.0/lib/omniauth/strategies/alicloud.rb0000644000004100000410000000173514543753637024074 0ustar www-datawww-data# frozen_string_literal: true module OmniAuth module Strategies class Alicloud < OmniAuth::Strategies::OAuth2 option :name, 'alicloud' option :client_options, { site: 'https://oauth.aliyun.com/', authorize_url: 'https://signin.aliyun.com/oauth2/v1/auth', token_url: 'https://oauth.aliyun.com/v1/token' } uid do raw_info['sub'] end info do { name: raw_info['name'], email: raw_info['login_name'] || raw_info['upn'], username: raw_info['name'], sub: raw_info['sub'], aid: raw_info['aid'], uid: raw_info['uid'] } end extra do { raw_info: raw_info } end def callback_url full_host + callback_path end protected def raw_info @raw_info ||= access_token.get('/v1/userinfo').parsed || {} end end end end OmniAuth.config.add_camelization 'alicloud', 'Alicloud' omniauth-alicloud-3.0.0/LICENSE.txt0000644000004100000410000000206414543753637017026 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) 2021 jimcheung Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. omniauth-alicloud-3.0.0/.bundle/0000755000004100000410000000000014543753637016530 5ustar www-datawww-dataomniauth-alicloud-3.0.0/.bundle/config0000644000004100000410000000004114543753637017713 0ustar www-datawww-data--- BUNDLE_WITHOUT: "production" omniauth-alicloud-3.0.0/Rakefile0000644000004100000410000000016514543753637016650 0ustar www-datawww-datarequire "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) task :default => :spec omniauth-alicloud-3.0.0/Gemfile0000644000004100000410000000014114543753637016470 0ustar www-datawww-datasource "https://rubygems.org" gemspec gem "rake", "~> 12.0" gem "rspec", "~> 3.0" gem "byebug" omniauth-alicloud-3.0.0/README.md0000644000004100000410000000175414543753637016467 0ustar www-datawww-data# Omniauth AliCloud 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). ## Installation Add this line to your application's Gemfile: ```ruby gem 'omniauth-alicloud' ``` And then execute: ``` $ bundle install ``` ## Usage `OmniAuth::Strategies::Alicloud` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth. Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`: ```ruby Rails.application.config.middleware.use OmniAuth::Builder do provider :alicloud, ENV['ALICLOUD_APP_SECRET_ID'], ENV['ALICLOUD_APP_SECRET_KEY'] end ``` ## Contributing Bug reports and pull requests are welcome on GitLab at https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). omniauth-alicloud-3.0.0/CHANGELOG.md0000644000004100000410000000056514543753637017020 0ustar www-datawww-data# Change Log ## v2.0.0 (2022-09-16) Makes compatible with OmniAuth 2 and requires it. Note: https://gitlab.com/gitlab-jh/jh-team/omniauth-alicloud/-/merge_requests/1 for reasoning - Thanks @jessieay _Major version bump as no longer supports Omniauth 1._ ## v2.0.1 (2023-01-17) Fix callback url mismatch. ## v3.0.0 (2023-09-15) Change use sub openid as omniauth uid.