keycloak-api-rails 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0e8e7c47df127347543955ffc2ed362dc9c2efb549bc970f0efdd519f8cfb1a
4
- data.tar.gz: 5b77f9cf1171a36db3d80c6cd31e0df8f0acb00a58916e9b7a4fdcfdec331ecd
3
+ metadata.gz: 33430ef5e956f8a04b6e3de5b91bd4e3103fa45a005fccea305358f07936eeb3
4
+ data.tar.gz: '09a89800ff5dec64ba052f666dce839593ed85e3bf5d226d00050e2850387163'
5
5
  SHA512:
6
- metadata.gz: 38edbedbe88b629c6c6728eda1b60670cd9dd6b03f6246c4bfd79bcc6fd3832922c504b91c15f4f4c7e86128e4d143800f5562292cf0f38877e73f0f39f4a8ff
7
- data.tar.gz: d6e9d6ca5a7d5a531e09e7e2fe63d026bd53f088ceabbb2484e59ab36ac1aee234d949ac30c342f67a2784442dacfb1d502762f35999d977d8175189c19193fa
6
+ metadata.gz: 1965c3091b5a5b205e4c83dd233768889ea91a3585ddb5b81ed2d13643b0fbce2fada58ddcedb9bbb61865477395eafdd18f2fe15b4f49bbef497b130484262f
7
+ data.tar.gz: 5869dd930cb4f68189f38f7bc2c7405e92b59c384a82718aed93a2d158b6ce29de563e6363b557a1ef5744ca73985d98661be4a56c901b96a0a0c17cb2a1f04a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.12.1] - 2023-04-15
9
+
10
+ * Fixes for opt-in mode (#48) (thanks to @theSteveMitchell)
11
+
8
12
  ## [0.12.0] - 2023-04-11
9
13
 
10
14
  * Introduce Opt-in mode as an alternative configuration (thanks to @theSteveMitchell)
@@ -28,7 +28,7 @@ module Keycloak
28
28
 
29
29
  def authentication_failed(message)
30
30
  logger.info(message)
31
- [401, {"Content-Type" => "application/json"}, [ { error: message }.to_json]]
31
+ render status: :unauthorized, json: { error: message }
32
32
  end
33
33
 
34
34
  def authentication_succeeded(env, decoded_token)
@@ -83,10 +83,14 @@ module Keycloak
83
83
  end
84
84
 
85
85
  def self.read_token_from_query_string(uri)
86
- parsed_uri = URI.parse(uri)
87
- query = URI.decode_www_form(parsed_uri.query || "")
88
- query_string_token = query.detect { |param| param.first == QUERY_STRING_TOKEN_KEY }
89
- query_string_token&.second
86
+ if uri.present?
87
+ parsed_uri = URI.parse(uri)
88
+ query = URI.decode_www_form(parsed_uri.query || "")
89
+ query_string_token = query.detect { |param| param.first == QUERY_STRING_TOKEN_KEY }
90
+ query_string_token&.second
91
+ else
92
+ ""
93
+ end
90
94
  end
91
95
 
92
96
  def self.create_url_with_token(uri, token)
@@ -1,3 +1,3 @@
1
1
  module Keycloak
2
- VERSION = "0.12.0"
2
+ VERSION = "0.12.1"
3
3
  end
@@ -235,6 +235,13 @@ RSpec.describe Keycloak::Service do
235
235
  end
236
236
  end
237
237
 
238
+ context "and query string is nil" do
239
+ let(:query_string) { nil }
240
+ it "returns an empty token" do
241
+ expect(@token).to eq ""
242
+ end
243
+ end
244
+
238
245
  context "but in the query string" do
239
246
  let(:query_string) { "&authorizationToken=#{query_string_token}" }
240
247
  it "returns the query string token" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycloak-api-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorent Lempereur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-11 00:00:00.000000000 Z
11
+ date: 2023-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails