osso 0.0.3.19 → 0.0.3.24

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: 995be763d7567651350cc953d6d800a8bbd86e3de1eda57f7ab673869ffbb6dc
4
- data.tar.gz: 01aa99f9fc68465df111624a22175ce2d5d110e94e2389d128a1c94cb0466494
3
+ metadata.gz: 5d48075518d12201e52ee12e25f7db5de43ef13e3fc04e8902ba27787aabbd4a
4
+ data.tar.gz: f511a13be8a898cf863e00966fc551b3d5a3f4bb5999f534ccb3bf0d1de7004e
5
5
  SHA512:
6
- metadata.gz: e4f45a4c188da6bf0adce208bec4b32ad76850136bed6af4ca221f0f5ccf94c6547b19a8486b92b1e05c57f0224389b25b7f8efd5f0c3a9c260a4a745cb2687c
7
- data.tar.gz: 7df17b8bd2726c59a828d4ceb6f04e2246eeb9ac651f12a6f7956f0c65a9b45e5dcc4c2266d55eec3816f64ae635f9fbf70a37cb57eb0f4efc94c1b49803499c
6
+ metadata.gz: ee6f360d04918e40109a8349a5f8230d79069cd8399731ab98be4cf11d52a1979ca6cdcb5d2f18d2b20f9af1e0bb8d7b1310d30a43ef8dbe9e7835d7e3663b4f
7
+ data.tar.gz: d23ba69bfa85ea6174df1789aadad1edc53fcaaffe93cd7f1773d923687bd492d65abe6aba0cd680813c66d84f8410d3b985d1d9453ac0bd2406d416c8e01a1a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osso (0.0.3.19)
4
+ osso (0.0.3.24)
5
5
  activesupport (>= 6.0.3.2)
6
6
  graphql
7
7
  jwt
@@ -15,4 +15,3 @@ require_relative 'mutations/delete_oauth_client'
15
15
  require_relative 'mutations/regenerate_oauth_credentials'
16
16
  require_relative 'mutations/set_redirect_uris'
17
17
  require_relative 'mutations/update_app_config'
18
-
@@ -10,14 +10,13 @@ module Osso
10
10
  argument :logo_url, String, required: false
11
11
  argument :contact_email, String, required: false
12
12
 
13
-
14
13
  field :app_config, Types::AppConfig, null: true
15
14
  field :errors, [String], null: false
16
15
 
17
16
  def resolve(**args)
18
17
  app_config = Osso::Models::AppConfig.find
19
18
  return response_data(app_config: app_config) if app_config.update(**args)
20
-
19
+
21
20
  response_error(errors: e)
22
21
  end
23
22
 
@@ -15,6 +15,10 @@ module Osso
15
15
  def enterprise_authorized?(domain)
16
16
  context[:scope] == domain
17
17
  end
18
+
19
+ def context_domain
20
+ context[:email].split('@')[1]
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -7,7 +7,7 @@ module Osso
7
7
  type Types::EnterpriseAccount.connection_type, null: true
8
8
 
9
9
  def resolve(sort_column: nil, sort_order: nil)
10
- return Array(Osso::Models::EnterpriseAccount.find_by(domain: context[:scope])) unless internal_authorized?
10
+ return Array(Osso::Models::EnterpriseAccount.find_by(domain: context_domain)) unless internal_authorized?
11
11
 
12
12
  accounts = Osso::Models::EnterpriseAccount
13
13
 
@@ -12,10 +12,6 @@ module Osso
12
12
 
13
13
  def name
14
14
  service.titlecase
15
- # raise(
16
- # NoMethodError,
17
- # '#name must be defined on each provider specific subclass',
18
- # )
19
15
  end
20
16
 
21
17
  def saml_options
@@ -29,7 +25,7 @@ module Osso
29
25
 
30
26
  def assertion_consumer_service_url
31
27
  [
32
- ENV.fetch('BASE_URL'),
28
+ root_url,
33
29
  'auth',
34
30
  'saml',
35
31
  id,
@@ -44,6 +40,12 @@ module Osso
44
40
 
45
41
  self.status = 'CONFIGURED' if sso_url && sso_cert
46
42
  end
43
+
44
+ def root_url
45
+ return "https://#{ENV['HEROKU_APP_NAME']}.herokuapp.com" if ENV['HEROKU_APP_NAME']
46
+
47
+ ENV.fetch('BASE_URL')
48
+ end
47
49
  end
48
50
  end
49
51
  end
@@ -23,8 +23,8 @@ module Osso
23
23
  end
24
24
 
25
25
  def generate_secrets
26
- self.identifier = SecureRandom.hex(16)
27
- self.secret = SecureRandom.hex(32)
26
+ self.identifier ||= SecureRandom.hex(16)
27
+ self.secret ||= SecureRandom.hex(32)
28
28
  end
29
29
  end
30
30
  end
@@ -13,6 +13,12 @@ module Osso
13
13
  end
14
14
 
15
15
  namespace '/admin' do
16
+ get '/login' do
17
+ token_protected!
18
+
19
+ erb :admin
20
+ end
21
+
16
22
  get '' do
17
23
  internal_protected!
18
24
 
@@ -20,7 +26,7 @@ module Osso
20
26
  end
21
27
 
22
28
  get '/enterprise' do
23
- internal_protected!
29
+ token_protected!
24
30
 
25
31
  erb :admin
26
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Osso
4
- VERSION = '0.0.3.19'
4
+ VERSION = '0.0.3.24'
5
5
  end
@@ -6,13 +6,21 @@ describe Osso::Models::IdentityProvider do
6
6
  subject { create(:okta_identity_provider) }
7
7
 
8
8
  describe '#assertion_consumer_service_url' do
9
- it 'returns the expected URI' do
9
+ it 'returns the expected URI for BASE_URL' do
10
10
  ENV['BASE_URL'] = 'https://example.com'
11
11
 
12
12
  expect(subject.assertion_consumer_service_url).to eq(
13
13
  "https://example.com/auth/saml/#{subject.id}/callback",
14
14
  )
15
15
  end
16
+
17
+ it 'returns the expected URI for HEROKU_APP_NAME' do
18
+ ENV['HEROKU_APP_NAME'] = 'test'
19
+
20
+ expect(subject.assertion_consumer_service_url).to eq(
21
+ "https://test.herokuapp.com/auth/saml/#{subject.id}/callback",
22
+ )
23
+ end
16
24
  end
17
25
 
18
26
  describe '#saml_options' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.19
4
+ version: 0.0.3.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport