strongmind-auth 1.1.84 → 1.1.86
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/app/controllers/concerns/strong_mind_nav.rb +2 -1
- data/lib/strongmind/auth/version.rb +1 -1
- data/lib/strongmind/common_nav_fetcher.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0726b64bdd92646f5321f5f6050ea0d097752e7407bb4a1b87b3c1352703c0a8
|
4
|
+
data.tar.gz: ece8fc306bfcaf1d89a8cbdc02271a99c47bb85851d65d0883e2d70cf99187d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '02497ab7508a71d2f538825d09a6e94439c75030d3df1a92a42083f3bc8c8bc5b9f94e2d26384de3c8ed5d6f84ab23c99163c4081d7dcb557d66bf1840a0b658'
|
7
|
+
data.tar.gz: 2e4fa4e9de34ca86ca779c38968136f46ce81dcc07b1ab7620cb0814cfb264bee2a04acbf7756247b23b42d8a7aab660d6a45b257beb7a4efb282885c3038819
|
data/README.md
CHANGED
@@ -6,6 +6,18 @@ Ruby gem for authentication in a rails app
|
|
6
6
|
|
7
7
|
1. Use [Repository Dashboard](https://repository-dashboard.strongmind.com/repositories/new) to create a new repository
|
8
8
|
with the rails-template.
|
9
|
+
1. If you **did not** use the rails-template from Repository Dashboard, you will need to add the following to your Gemfile:
|
10
|
+
```ruby
|
11
|
+
gem "strongmind-platform-sdk"
|
12
|
+
gem 'font-awesome-rails'
|
13
|
+
gem 'devise'
|
14
|
+
gem 'omniauth'
|
15
|
+
gem 'omniauth_openid_connect'
|
16
|
+
gem 'omniauth-rails_csrf_protection'
|
17
|
+
gem 'dotenv-rails'
|
18
|
+
gem 'sentry-rails'
|
19
|
+
```
|
20
|
+
1. If you want to use the common navbar you will also need to go to [section 5 and 6 in the existing application doc](https://github.com/StrongMind/rails-auth/blob/main/docs/adding-to-an-existing-app.md) and follow the instructions there after running the generator in step 2.
|
9
21
|
1. Navigate to the repo folder in a terminal and execute `rails g strongmind:install`
|
10
22
|
1. Move app root to authenticated root in routes. Should look like this:
|
11
23
|
```ruby
|
@@ -13,6 +25,7 @@ Ruby gem for authentication in a rails app
|
|
13
25
|
root to: 'home#index' # or whatever makes sense for your app
|
14
26
|
end
|
15
27
|
```
|
16
|
-
1. Create a new client in identity server and `IDENTITY_CLIENT_ID` and `IDENTITY_CLIENT_SECRET` values to .env file.
|
28
|
+
1. Create a [new client in stage identity server](https://devlogin.strongmind.com/Clients/Create) and `IDENTITY_CLIENT_ID` and `IDENTITY_CLIENT_SECRET` values to .env file.
|
29
|
+
1. Create a [new client in prod identity server](https://login.strongmind.com/Clients/Create) and `IDENTITY_CLIENT_ID` and `IDENTITY_CLIENT_SECRET` values to .env file.
|
17
30
|
1. Execute `rails dev:cache` to turn on caching in development.
|
18
31
|
1. Execute `bin/dev`
|
@@ -6,7 +6,8 @@ module StrongMindNav
|
|
6
6
|
|
7
7
|
def fetch_common_nav
|
8
8
|
begin
|
9
|
-
|
9
|
+
authenticity_token = form_authenticity_token
|
10
|
+
navbar = Strongmind::CommonNavFetcher.new(current_user, request).retrieve(menu_items, authenticity_token)
|
10
11
|
|
11
12
|
@top_navbar_html = navbar[:top_navbar_html]
|
12
13
|
@bottom_navbar_html = navbar[:bottom_navbar_html]
|
@@ -27,8 +27,8 @@ module Strongmind
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
|
-
def retrieve(menu_items)
|
31
|
-
response = fetch_navbar_data(build_nav_items(menu_items))
|
30
|
+
def retrieve(menu_items, authenticity_token)
|
31
|
+
response = fetch_navbar_data(build_nav_items(menu_items), authenticity_token)
|
32
32
|
parse_navbar(response)
|
33
33
|
end
|
34
34
|
|
@@ -47,11 +47,12 @@ module Strongmind
|
|
47
47
|
path_to_compare.include?(sanitized_path) || path_to_compare.include?(sanitized_path.pluralize)
|
48
48
|
end
|
49
49
|
|
50
|
-
def fetch_navbar_data(nav_items)
|
50
|
+
def fetch_navbar_data(nav_items, authenticity_token)
|
51
51
|
session = refresh_session
|
52
52
|
access_token = session[:access_token]
|
53
53
|
|
54
|
-
|
54
|
+
payload = nav_items.merge(authenticity_token: ).to_json
|
55
|
+
connection.post(navbar_endpoint, payload, 'Authorization' => "Bearer #{access_token}")
|
55
56
|
end
|
56
57
|
|
57
58
|
def connection
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strongmind-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.86
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Belding
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|