heimdall_auth 1.9.0 → 1.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0904885207b67efe16aefc1bd5c37a57490f412c199bdf0275a22b56a3f90b84'
4
- data.tar.gz: 278819290094fa8e3ae2e7640e423c48dbdbc926343c1896ca2ac9eb84b36e37
3
+ metadata.gz: 224f15277c180a85265f085959acfbf033543335add8a4989717c4eb486b3a0a
4
+ data.tar.gz: b7fb140f8184ace1ed89f04054f7d3c2abfdb503aef9aa3b68d2bf4911f89406
5
5
  SHA512:
6
- metadata.gz: ddb292841b5c583e820fecec2162263d8dd34fb125681bad493e80c73f00fcb242026b649d924b57a9abc5f2003b65bf918bb90c9d07816242831bc019bf0080
7
- data.tar.gz: 6150a29eaab129ce489f897ab36106de8e46da278f14db29438a607bfe077f481527492d0089903b9df1e25fc0fdff52f24a87932326a326bdb3b891e4d25250
6
+ metadata.gz: 16c9d7755c9bfaaa4ab9d80b8737554ec9319eb768fa4ae48e87ca1dd7641d500706e60a39e666116efb3e1508601454b663f0f3d90b86418a5f8ebbd082ef05
7
+ data.tar.gz: 9d1b07f0e74d1bdc07594f68d2e2ef9041e73c0ffd4039e2cf428dab480a6516a44fdb5fd8f065b6a428291d7ece97fa7e2c9761c136ec90416b56c9c79551a4
data/README.md CHANGED
@@ -34,6 +34,7 @@ Options:
34
34
  - PATH - where to mount the engine
35
35
  - ACTION & RESOURCE - like any action and resource in cancancan
36
36
  - :accessible_via_token -> Defines paths that are available via a particular token. e.g. for Watchdog services like Datadog
37
+ - URL needs then to have the token as `?token=secretpassword` in the query params. Like: `https://webhook.vesputi-abc.de/sidekiq/stats?token=secretpassword`
37
38
 
38
39
  ## Installation and Usage
39
40
 
@@ -114,3 +115,26 @@ RSpec.describe "/foobar", type: :request do
114
115
  before { allow_any_instance_of(ApplicationController).to receive(:current_user) { HeimdallAuth::User.new(is_editor: true) } }
115
116
  end
116
117
  ```
118
+
119
+ # Usage with RSpec
120
+ ## Simulate an Admin user
121
+
122
+ See the example:
123
+ ```ruby
124
+ require 'rails_helper'
125
+
126
+ RSpec.describe "/cards", type: :request do
127
+
128
+ let(:admin_user) {
129
+ HeimdallAuth::User.new(email: "foo@bar.com", is_admin: true)
130
+ }
131
+
132
+ describe "GET /index" do
133
+ before(:each) do
134
+ allow_any_instance_of( HeimdallAuth::ControllerAdditions ).to receive(:current_user).and_return(admin_user)
135
+ end
136
+
137
+ it "renders a successful response" do
138
+ Card.create! valid_attributes
139
+ get cards_url
140
+ ```
@@ -14,7 +14,7 @@ class HeimdallAuth::SessionsController < ApplicationController
14
14
 
15
15
  def create
16
16
  auth = request.env["omniauth.auth"]
17
- session[:access_token] = auth.credentials.token
17
+ session[:access_token] = auth&.credentials&.token
18
18
  redirect_to( session[:last_url] || request.base_url, allow_other_host: true)
19
19
  end
20
20
 
@@ -29,7 +29,7 @@ module HeimdallAuth
29
29
 
30
30
  def current_environment
31
31
  begin
32
- @current_environment ||= current_user.key_environment || params[:environment]
32
+ @current_environment ||= current_user.app_environment || params[:environment]
33
33
  rescue NoMethodError, Exception => e
34
34
  nil
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module HeimdallAuth
2
- VERSION = '1.9.0'
2
+ VERSION = '1.10.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heimdall_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Meye
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-02 00:00:00.000000000 Z
11
+ date: 2026-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.3.7
142
+ rubygems_version: 3.3.27
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Summary of HeimdallAuth.