omniauth-wix 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7add28ad319c680d3e116e42c54d30836c1664fc5744bae99ba608aa11a7fbe2
4
+ data.tar.gz: 315b49bd7d37028425b84a8a46d66c2cb6571defe3a75fb4737792da789044f6
5
+ SHA512:
6
+ metadata.gz: c75551264f497d4843779517dc3231b71800342d96dcf78b6c5fef7b4b739e2767466c30cf02a525984b39ce33c5b41e60bc84bfbe9ceb5251a2c420d0dfc5c4
7
+ data.tar.gz: 3c5d438bef3bb6c87d24b56efd48192fed62b22e8fa88546847c14b4e4e08a796ca26beef4ad72eff56101e5ba11842681c9a804dda6be2c824a68ab284489d5
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-wix.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-wix (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (12.3.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ omniauth-wix!
16
+ rake (~> 12.0)
17
+
18
+ BUNDLED WITH
19
+ 2.0.2
@@ -0,0 +1,38 @@
1
+ # Omniauth::Wix
2
+
3
+ Wix Strategy for OmniAuth 2.0
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-wix'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-wix
20
+
21
+ ## Usage
22
+
23
+ Depends on https://github.com/omniauth/omniauth
24
+
25
+ Setup OAuth credentials at https://dev.wix.com/
26
+
27
+ Here's a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:
28
+
29
+ Rails.application.config.middleware.use OmniAuth::Builder do
30
+ provider :wix, ENV['WIX_APP_ID'], ENV['WIX_APP_SECRET']
31
+ end
32
+
33
+ Authenticate the user by having them visit /auth/wix
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pixetree/omniauth-wix.
38
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/wix"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -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
@@ -0,0 +1,41 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Wix < OmniAuth::Strategies::OAuth2
6
+ option :name, 'wix'
7
+
8
+ option :client_options, {
9
+ :authorize_url => 'https://www.wix.com/installer/install',
10
+ :token_url => 'https://www.wix.com/oauth/access.json'
11
+ }
12
+
13
+ option :provider_ignores_state, true
14
+
15
+ def client
16
+ ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options)) do |b|
17
+ b.request :json
18
+ b.adapter Faraday.default_adapter
19
+ end
20
+ end
21
+
22
+ def authorize_params
23
+ super.tap do |params|
24
+ params["redirectUrl"] = callback_url
25
+ params["appId"] = options[:client_id]
26
+ params["token"] = request.params["token"]
27
+ end
28
+ end
29
+
30
+ def callback_url
31
+ full_host + script_name + callback_path
32
+ end
33
+
34
+ def build_access_token
35
+ verifier = request.params["code"]
36
+ params = { :redirect_uri => callback_url }.merge(token_params.to_hash(:symbolize_keys => true).merge({ headers: { 'Content-Type' => 'application/json' } }))
37
+ client.auth_code.get_token(verifier, params, deep_symbolize(options.auth_token_params))
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth/wix/version"
2
+ require "omniauth/strategies/wix"
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Wix
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ require_relative 'lib/omniauth/wix/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "omniauth-wix"
5
+ spec.version = Omniauth::Wix::VERSION
6
+ spec.authors = ["Serene Yew"]
7
+ spec.email = ["serene@pixeltree.ca"]
8
+
9
+ spec.summary = 'Omniauth strategy for wix'
10
+ spec.homepage = 'http://github.com/pixeltree/omniauth-wix'
11
+
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = "http://github.com/pixeltree/omniauth-wix"
16
+ # spec.metadata["changelog_uri"] = "http://github.com/pixeltree/omniauth-wix/"
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-wix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Serene Yew
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-12-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - serene@pixeltree.ca
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - Gemfile.lock
23
+ - README.md
24
+ - Rakefile
25
+ - bin/console
26
+ - bin/setup
27
+ - lib/omniauth/strategies/wix.rb
28
+ - lib/omniauth/wix.rb
29
+ - lib/omniauth/wix/version.rb
30
+ - omniauth-wix.gemspec
31
+ homepage: http://github.com/pixeltree/omniauth-wix
32
+ licenses: []
33
+ metadata:
34
+ homepage_uri: http://github.com/pixeltree/omniauth-wix
35
+ source_code_uri: http://github.com/pixeltree/omniauth-wix
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.3.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.1.2
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Omniauth strategy for wix
55
+ test_files: []