login_radius 11.3.0 → 11.4.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 +4 -4
- data/README.md +4 -4
- data/lib/login_radius/request_client.rb +40 -0
- data/lib/login_radius/version.rb +1 -1
- 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: b0f37dbd647854caec292ac3a27dae1cc46f379843a34f56c923bd92db81e294
|
4
|
+
data.tar.gz: cd9f01b10e3f61b63ff6dc8938856a35622f73399b5509b0986f3b4d76d93a5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40f3b4f32ab8fd4e634060e35f3de1c3e3da90f27d6db2fd3f6a51a38f75ca02100f784ca8ecfd41e38fb5e6e9dad749b8038017ab91eacf322d418bc20bb06e
|
7
|
+
data.tar.gz: 295da43200cbcbb3d5167386ec9bb67871ce2ba85af8daa49fd8d5cb915c0248bca2d762951c9e0fb90ad2c5b5686cc753ab0c16701909758eadbf5f76502c63
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Install the SDK by adding LoginRadius to your application's `Gemfile`.
|
4
4
|
|
5
|
-
```
|
6
|
-
gem 'login_radius', '~> 11.
|
5
|
+
```shell
|
6
|
+
gem 'login_radius', '~> 11.4.0'
|
7
7
|
```
|
8
8
|
|
9
9
|
Then, run `$ bundle`. A copy of the SDK can also be found on our [Github](https://github.com/LoginRadius/ruby-on-rails-gem/tree/master).
|
@@ -12,7 +12,7 @@ Then, run `$ bundle`. A copy of the SDK can also be found on our [Github](https:
|
|
12
12
|
|
13
13
|
1)Before using any of the functions available in the library, its corresponding module must first define the global constant in `config/application.yml`:
|
14
14
|
|
15
|
-
```
|
15
|
+
```ruby
|
16
16
|
SITE_NAME: "<site name>"
|
17
17
|
API_KEY: "<api-key>"
|
18
18
|
API_SECRET: "<api-secret>"
|
@@ -26,7 +26,7 @@ Create `login_radius.rb` in `/config/initializers`:
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
```
|
29
|
+
```ruby
|
30
30
|
require 'login_radius'
|
31
31
|
|
32
32
|
::AccountApi = LoginRadius::AccountApi.new
|
@@ -279,6 +279,46 @@ module LoginRadius
|
|
279
279
|
return headers
|
280
280
|
end
|
281
281
|
|
282
|
+
# Local - Generate SOTT:
|
283
|
+
# Generates a Secured One Time Token manually.
|
284
|
+
#
|
285
|
+
# Do not pass the time difference if you are passing start_time & end_time.
|
286
|
+
# @params time_difference [Integer] (Optional)The time_difference will be used to set the expiration time of SOTT, If you do not pass time_difference then the default expiration time of SOTT is 10 minutes.
|
287
|
+
# @params api_key [String] (Optional) LoginRadius Api Key.
|
288
|
+
# @params api_secret [String] (Optional) LoginRadius Api Secret.
|
289
|
+
# You can pass the start_time , end_time interval and the SOTT will be valid for this time duration.
|
290
|
+
# @params start_time [String] (Optional) The start time of the SOTT.
|
291
|
+
# @params end_time [String] (Optional) The end time of the SOTT.
|
292
|
+
# @returns sott [String] LoginRadius Secured One Time Token
|
293
|
+
def get_sott(time_difference="", api_key="", api_secret="",start_time="",end_time="")
|
294
|
+
|
295
|
+
key= !isNullOrWhiteSpace(api_key) ? api_key:ENV['API_KEY']
|
296
|
+
time_difference= !isNullOrWhiteSpace(time_difference) ? time_difference.to_i : 10
|
297
|
+
secret=!isNullOrWhiteSpace(api_secret) ? api_secret:ENV['API_SECRET']
|
298
|
+
start_date_time=!isNullOrWhiteSpace(start_time)&&!isNullOrWhiteSpace(end_time)? start_time:Time.now.getutc().strftime('%Y/%m/%d %H:%M:%S')
|
299
|
+
end_date_time =!isNullOrWhiteSpace(start_time)&&!isNullOrWhiteSpace(end_time)? end_time:(Time.now.getutc() + (time_difference*60)).strftime('%Y/%m/%d %H:%M:%S')
|
300
|
+
|
301
|
+
|
302
|
+
plain_text = start_date_time + '#' + key + '#' + end_date_time
|
303
|
+
iter = 10000
|
304
|
+
salt = "\x00\x00\x00\x00\x00\x00\x00\x00"
|
305
|
+
key_len = KEY_SIZE / 8
|
306
|
+
cipher_key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(secret, salt, iter, key_len)
|
307
|
+
|
308
|
+
cipher = OpenSSL::Cipher.new('aes-' + KEY_SIZE.to_s + '-cbc')
|
309
|
+
cipher.encrypt
|
310
|
+
cipher.key = cipher_key
|
311
|
+
cipher.iv = INIT_VECTOR
|
312
|
+
|
313
|
+
encrypted = cipher.update(plain_text) + cipher.final
|
314
|
+
encrypted_b64 = Base64.strict_encode64(encrypted)
|
315
|
+
|
316
|
+
hash = Digest::MD5.hexdigest(encrypted_b64)
|
317
|
+
sott = encrypted_b64 + '*' + hash
|
318
|
+
return sott
|
319
|
+
end
|
320
|
+
|
321
|
+
# DEPRECATED: Please use get_sott instead.
|
282
322
|
# Local - Generate SOTT:
|
283
323
|
# Generates a Secured One Time Token manually.
|
284
324
|
#
|
data/lib/login_radius/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: login_radius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LoginRadius
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|