omniauth-vis 0.0.7 → 0.0.9

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: 58532f5d8b991bd691e31cc5c2ecc4be40a4150924db377fcfb023fdc382dc4f
4
- data.tar.gz: 22a1a8872a06767a16ffa076658d0a489ecd793714586842206117649fa2b5ef
3
+ metadata.gz: b14af6f1e3470751c7d59576d8f4e36955bbac66993a428c4ad25cc7c0c55c93
4
+ data.tar.gz: 238c6eb40d541a52ed53c28dec01cffce45f3a96ed145b14cb44d34c943e71aa
5
5
  SHA512:
6
- metadata.gz: 225eb0ce4d3456440c579fde579c2f31dace3253def8f8d896f1e6f6b6ee21e4badffc02a83677ae60cfb965d9fc4f7d20d64c85e3ceb528040a0e9decfd7a62
7
- data.tar.gz: 115fe0d357962bc506cd7242906f7aaec75d60f47a8aa2b1a40053d57def295379039652b965ad17a2f108d60f3be59409a1e82cf98f03d969e487be2aee4f58
6
+ metadata.gz: '01120799fc73d04e6efec71f0110728862a4375d46d29a99946420337e8982f5165b95ab443a69ba5fbf3ad0901303afc5d26e2624d38e508afdb4108e77d4a2'
7
+ data.tar.gz: c07bbb587a80adf75747e9f526b1366c470a060365dd995590742b5955b7cf88fd9a02f0988c79f83f854f2f40dd8d5cdcf449377d24ffd6de7e1d8a41f5bf75
data/README.md CHANGED
@@ -27,9 +27,9 @@ gem add omniauth-vis
27
27
  # config/initializers/vis.rb
28
28
 
29
29
  Rails.application.config.vis = {
30
+ server_url: "https://identity.dhamma.org/"
30
31
  app_id: "APP_ID_PROVIDED",
31
32
  app_secret: "APP_SECRET_PROVIDED",
32
- app_url: "https://identity.server.dhamma.org/"
33
33
  }
34
34
  ```
35
35
 
@@ -43,10 +43,7 @@ You first need to install `omniauth-oauth2` gem, then add a new provider :
43
43
  require "omniauth/strategies/vis"
44
44
 
45
45
  Rails.application.config.middleware.use OmniAuth::Builder do
46
- provider :vis, Rails.application.config.vis["app_id"], Rails.application.config.vis["app_secret"],
47
- {
48
- scope: "default"
49
- }
46
+ provider :vis, Rails.application.config.vis["app_id"], Rails.application.config.vis["app_secret"]
50
47
  end
51
48
  ```
52
49
 
@@ -56,17 +53,17 @@ end
56
53
 
57
54
  ```
58
55
  require "vis/api"
59
- @vis_api = Vis::Api.new
60
- @vis_service.get("api_path")
61
- @vis_service.post("api_path", data)
56
+ @vis_api = Vis::Api.new(client_id: "xx", client_secret: "xx", server_url: "https://identity.dhamma.org")
57
+ @vis_api.get("api_path")
58
+ @vis_api.post("api_path", data)
62
59
  ```
63
60
 
64
- Documentation about available api can be found at [https://identity.server.dhamma.org/doc](https://identity.server.dhamma.org/doc)
61
+ Documentation about available api can be found at [https://test.identity.dhamma.org/doc](https://test.identity.dhamma.org/doc)
65
62
 
66
63
  Example
67
64
 
68
65
  ```
69
- Vis::Api.new.post("/api/v1/users", {
66
+ @vis_api.post("/api/v1/users", {
70
67
  email: "email@test.com",
71
68
  username: "test",
72
69
  encrypted_password: "xxxxxxxxxx"
@@ -8,24 +8,18 @@ module OmniAuth
8
8
  option :name, :vis
9
9
 
10
10
  option :client_options,
11
- site: Rails.application.config.vis['app_url'],
11
+ site: Rails.application.config.vis['server_url'],
12
12
  authorize_path: '/oauth/authorize'
13
13
 
14
+ option :scope, 'default'
15
+
14
16
  def on_path?(path)
15
17
  current_path.squeeze('/').casecmp(path.squeeze('/')).zero?
16
18
  end
17
19
 
18
20
  def setup_phase
19
- # Authorize extra params
20
- authorized_params = [
21
- :locale, :iframe,
22
- :allow_sign_up, :allowed_external_providers, :confirm_identity,
23
- :app_name, :login_title, :login_message,
24
- :back_button, :back_button_text, :back_button_url,
25
- :extra_agreement_title, :extra_agreement_text]
26
- authorized_params.each do |param|
27
- request.env['omniauth.strategy'].options[:authorize_params][param] = request.params[param.to_s]
28
- end
21
+ # Authorize all params to be passed to VIS
22
+ request.env['omniauth.strategy'].options[:authorize_params] = request.params.to_h
29
23
  end
30
24
 
31
25
  uid do
data/lib/vis/api.rb CHANGED
@@ -2,10 +2,10 @@
2
2
  # gets tokens so we can use the VIS API
3
3
  module Vis
4
4
  class Api
5
- def initialize
6
- @client_id = Rails.application.config.vis["app_id"]
7
- @client_secret = Rails.application.config.vis["app_secret"]
8
- @vis_app_url = Rails.application.config.vis["app_url"]
5
+ def initialize(server_url: "https://identity.dhamma.org", client_id:, client_secret:)
6
+ @client_id = client_id
7
+ @client_secret = client_secret
8
+ @vis_app_url = server_url
9
9
  @use_ssl = !Rails.env.development?
10
10
  end
11
11
 
@@ -30,10 +30,8 @@ module Vis
30
30
  end
31
31
 
32
32
  private def token_post
33
- # uri = URI.parse("#{@vis_app_url})
34
33
  http_client, uri = http_client_and_uri "/oauth/token"
35
34
  request = Net::HTTP::Post.new(uri.request_uri)
36
- # request.set_form_data({ "client_id" => @client_id, "client_secret" => @client_secret,
37
35
  request.set_form_data({ "client_id" => @client_id, "client_secret" => @client_secret,
38
36
  "grant_type" => "client_credentials" })
39
37
  http_client.request(request)
data/omniauth-vis.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'omniauth-vis'
5
- gem.version = '0.0.7'
5
+ gem.version = '0.0.9'
6
6
  # gem.license = 'MIT'
7
7
  gem.summary = 'Helper to connect to Vipassna Identity Server'
8
8
  gem.description = 'This allows you to connect to Vipassana identity server with your ruby app'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-vis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dhamma workers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-04 00:00:00.000000000 Z
11
+ date: 2023-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2