omniauth-logikura 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be009f285bbc998d2ea51aab7e24d95bf7905dcf0bbaaa8b74962b8ee5897758
4
- data.tar.gz: 2ef3b96da3858df22974951769683943fc66d684dc21260aaa6e65f8108cb98e
3
+ metadata.gz: da796ea2c7a404bcef1514ca88eb79edb106e4ac14cd30586f38f68d575f273d
4
+ data.tar.gz: 609ca41b6b3204983ba8843d00489cf6e0d9921975ace8d11b97c6576c020557
5
5
  SHA512:
6
- metadata.gz: 9af029b07f1deb6e400219af42b6468d5e6962ec6ff9eccf5b4ee134d46d7bad855bdc8334681527f0b7131993bcc5ae43003846fbffea7a3d1dc39918938a5c
7
- data.tar.gz: edc7afa8d15aca15fd9f38216eb973987b204a21fc2f8125a7ee2b4013bd0d0091a5ed450419bcb127be3201d8e03b9dac400821395af61adc9c2c0bb0e03609
6
+ metadata.gz: ffb4bebc01ce8a1ef8e6690a464234ed3f7ba5769d0659249af9d275a0ce142baa5ff218cd24fe568b04e81f84fd7e67700854c82da3385030809fc04c6cdfcc
7
+ data.tar.gz: b7e0fbf9602c58d96e0670ff72eb72b60da46b7a819bb1f5cb21b52655a5794fbcdc48ae07156be23a682c0207a7e8ac617d71953d3b391e977c578ae96684bc
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ .rspec_status
11
+ /vendor
12
+ /example/vendor
13
+ /example/Gemfile.lock
14
+ /Gemfile.lock
15
+ /.ruby-version
16
+ /.history
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.7
3
+ NewCops: disable
4
+ SuggestExtensions: false
5
+ Exclude:
6
+ - vendor/**/*
7
+ - spec/**/*
8
+ - example/vendor/**/*
9
+
10
+ Style/StringLiterals:
11
+ Enabled: true
12
+ EnforcedStyle: double_quotes
13
+
14
+ Style/StringLiteralsInInterpolation:
15
+ Enabled: true
16
+ EnforcedStyle: double_quotes
17
+
18
+ Layout/LineLength:
19
+ Max: 120
20
+
21
+ Style/Documentation:
22
+ Enabled: false
23
+
24
+ Naming/FileName:
25
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## [1.0.0] - 2022-04-11
2
+
3
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 ntakanashi
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,36 @@
1
+ # OmniAuth Logikura
2
+
3
+ Logikura OAuth2 Strategy for OmniAuth.
4
+
5
+ Read the Logikura API documentation for more details: https://logikura.dev/api
6
+
7
+ ## Installing
8
+
9
+ Add to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'omniauth-logikura'
13
+ ```
14
+
15
+ Then `bundle install`.
16
+
17
+ ## Usage
18
+
19
+ `OmniAuth::Strategies::Logikura` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
20
+
21
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
22
+
23
+ ```ruby
24
+ Rails.application.config.middleware.use OmniAuth::Builder do
25
+ provider :logikura, ENV['LOGIKURA_APP_ID'], ENV['LOGIKURA_SECRET'], scope: 'read'
26
+ end
27
+ ```
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ntakanashi/omniauth-logikura
32
+
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "omniauth/logikura"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/example/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "omniauth-logikura", path: "../"
6
+ gem "sinatra"
7
+ gem "sinatra-reloader"
8
+ gem "webrick"
data/example/app.rb ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sinatra"
4
+ require "sinatra/reloader"
5
+
6
+ # configure sinatra
7
+ set :run, false
8
+ set :raise_errors, true
9
+ set :sessions, true
10
+
11
+ get "/" do
12
+ content_type "text/html"
13
+
14
+ <<-HTML
15
+ <html>
16
+ <body>
17
+ <form action="/auth/logikura" method="POST">
18
+ <input type="hidden" name="authenticity_token" value='#{request.env["rack.session"]["csrf"]}'>
19
+ <button type="submit">Connect to Logikura</button>
20
+ </form>
21
+ </body>
22
+ </html>
23
+ HTML
24
+ end
25
+
26
+ get "/auth/:provider/callback" do
27
+ content_type "application/json"
28
+ MultiJson.encode(request.env)
29
+ end
data/example/config.ru ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+ require "omniauth-logikura"
5
+ require "./app"
6
+
7
+ use Rack::Session::Cookie, secret: "omniauth-logikura"
8
+
9
+ use OmniAuth::Builder do
10
+ provider :logikura, ENV["LOGIKURA_APP_ID"], ENV["LOGIKURA_SECRET"], scope: "read write"
11
+ end
12
+
13
+ run Sinatra::Application
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Omniauth
4
+ module Logikura
5
+ VERSION = "1.0.1"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/logikura/version"
4
+ require "omniauth/strategies/logikura"
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth-oauth2"
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Logikura < OmniAuth::Strategies::OAuth2
8
+ option :name, "logikura"
9
+
10
+ option :client_options,
11
+ site: "https://logikura.com",
12
+ api_site: "https://api.logikura.com",
13
+ authorize_path: "/oauth/authorize"
14
+
15
+ option :authorize_options, [:scope]
16
+
17
+ uid { info["data"]["company"]["id"] }
18
+
19
+ info { raw_info }
20
+
21
+ def raw_info
22
+ access_token.client.site = options.client_options[:api_site] # FIXME
23
+ @raw_info ||= access_token.get("/api/v1/credentials").parsed
24
+ end
25
+
26
+ def callback_url
27
+ full_host + script_name + callback_path
28
+ end
29
+
30
+ def setup_phase
31
+ options.client_options[:site] = ENV["LOGIKURA_URL"] if ENV["LOGIKURA_URL"]
32
+ options.client_options[:api_site] = ENV["LOGIKURA_API_URL"] if ENV["LOGIKURA_API_URL"]
33
+ super
34
+ end
35
+
36
+ def build_access_token
37
+ client.auth_code.get_token(
38
+ request.params["code"],
39
+ {
40
+ redirect_uri: callback_url
41
+ }.merge(token_params.to_hash(symbolize_keys: true)), deep_symbolize(options.auth_token_params)
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/logikura"
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/omniauth/logikura/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.required_ruby_version = ">= 2.7.0"
7
+ spec.name = "omniauth-logikura"
8
+ spec.version = Omniauth::Logikura::VERSION
9
+ spec.authors = ["ntakanashi"]
10
+ spec.email = ["ntakanashi725@gmail.com"]
11
+
12
+ spec.summary = "Logikura OAuth2 Strategy for OmniAuth"
13
+ spec.description = spec.summary
14
+ spec.homepage = "http://github.com/ntakanashi/omniauth-logikura"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency "oauth2", "~> 1.1"
25
+ spec.add_runtime_dependency "omniauth", "~> 2.0"
26
+ spec.add_runtime_dependency "omniauth-oauth2", "~> 1.7.1"
27
+
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "rubocop", "~> 1.7"
31
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-logikura
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ntakanashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-11 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -100,7 +100,25 @@ email:
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
- files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".rubocop.yml"
107
+ - CHANGELOG.md
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - bin/console
113
+ - bin/setup
114
+ - example/Gemfile
115
+ - example/app.rb
116
+ - example/config.ru
117
+ - lib/omniauth-logikura.rb
118
+ - lib/omniauth/logikura.rb
119
+ - lib/omniauth/logikura/version.rb
120
+ - lib/omniauth/strategies/logikura.rb
121
+ - omniauth-logikura.gemspec
104
122
  homepage: http://github.com/ntakanashi/omniauth-logikura
105
123
  licenses:
106
124
  - MIT