auth_token_store_provider 1.0.1 → 1.1.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 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 614b617bfe0780889bfe68b6bb3d7ed19ce49830
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9a7f3000546fac484c423cd42448e7845c330ca9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4b442d5637943c7eeee030abebc11e2f7cd4b899b5708b8da0802ebb7ec4de7f8685ca2edbc7b86ac107e50d2f560fbc65af95b275661c2f31779f9788133ed5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 40d6869eaf3eef585e6a8928744868eff5f847780d2e2184bf3b974e245438babd2b1db9b14214e673f9d6003059d277547273367177106e7f554dcc1fd07cc2
         
     | 
| 
         @@ -1,11 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module AuthTokenStoreProvider
         
     | 
| 
       2 
2 
     | 
    
         
             
              class StubClient
         
     | 
| 
      
 3 
     | 
    
         
            +
                def store
         
     | 
| 
      
 4 
     | 
    
         
            +
                  @@store ||= []
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
       3 
6 
     | 
    
         | 
| 
       4 
7 
     | 
    
         
             
                def initialize(configuration = {})
         
     | 
| 
       5 
     | 
    
         
            -
                  if configuration  
     | 
| 
       6 
     | 
    
         
            -
                     
     | 
| 
       7 
     | 
    
         
            -
                  elsif configuration['stub-data'] != {} || configuration['stub-data'] != nil
         
     | 
| 
       8 
     | 
    
         
            -
                    @store = configuration['stub-data']
         
     | 
| 
      
 8 
     | 
    
         
            +
                  if configuration['stub-data'] != {} || configuration['stub-data'] != nil
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @@store = configuration['stub-data']
         
     | 
| 
       9 
10 
     | 
    
         
             
                  end
         
     | 
| 
       10 
11 
     | 
    
         
             
                end
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
         @@ -15,7 +16,7 @@ module AuthTokenStoreProvider 
     | 
|
| 
       15 
16 
     | 
    
         | 
| 
       16 
17 
     | 
    
         
             
                def add(token_identifier:, authenticated_identifier:, token_issue_time:, token_expiry_time:, flow_identifier: nil)
         
     | 
| 
       17 
18 
     | 
    
         
             
                  raise RuntimeError, 'Failure accessing store' if @store_failure
         
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
      
 19 
     | 
    
         
            +
                  store << { token_identifier: token_identifier,
         
     | 
| 
       19 
20 
     | 
    
         
             
                              authenticated_identifier: authenticated_identifier,
         
     | 
| 
       20 
21 
     | 
    
         
             
                              token_issue_time: token_issue_time,
         
     | 
| 
       21 
22 
     | 
    
         
             
                              token_expiry_time: token_expiry_time }
         
     | 
| 
         @@ -23,14 +24,14 @@ module AuthTokenStoreProvider 
     | 
|
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
                def remove(token_identifier:, flow_identifier: nil)
         
     | 
| 
       25 
26 
     | 
    
         
             
                  raise RuntimeError, 'Failure accessing store' if @store_failure
         
     | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
      
 27 
     | 
    
         
            +
                  store.delete_if { |x| x[:token_identifier] == token_identifier }
         
     | 
| 
       27 
28 
     | 
    
         
             
                  true
         
     | 
| 
       28 
29 
     | 
    
         
             
                end
         
     | 
| 
       29 
30 
     | 
    
         | 
| 
       30 
31 
     | 
    
         
             
                def token_exist?(token_identifier:, authenticated_identifier:, token_issue_time:, token_expiry_time:, flow_identifier: nil)
         
     | 
| 
       31 
32 
     | 
    
         
             
                  raise RuntimeError, 'Failure accessing store' if @store_failure
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                   
     | 
| 
      
 34 
     | 
    
         
            +
                  store.each { |x|
         
     | 
| 
       34 
35 
     | 
    
         
             
                    if ((x[:token_identifier] == token_identifier) and
         
     | 
| 
       35 
36 
     | 
    
         
             
                        (x[:authenticated_identifier] == authenticated_identifier) and
         
     | 
| 
       36 
37 
     | 
    
         
             
                        (x[:token_issue_time] == token_issue_time) and
         
     | 
| 
         @@ -43,13 +44,13 @@ module AuthTokenStoreProvider 
     | 
|
| 
       43 
44 
     | 
    
         | 
| 
       44 
45 
     | 
    
         
             
                def remove_tokens_for(authenticated_identifier:, flow_identifier: nil)
         
     | 
| 
       45 
46 
     | 
    
         
             
                  raise RuntimeError, 'Failure accessing store' if @store_failure
         
     | 
| 
       46 
     | 
    
         
            -
                   
     | 
| 
      
 47 
     | 
    
         
            +
                  store.delete_if { |x| x[:authenticated_identifier] == authenticated_identifier }
         
     | 
| 
       47 
48 
     | 
    
         
             
                  true
         
     | 
| 
       48 
49 
     | 
    
         
             
                end
         
     | 
| 
       49 
50 
     | 
    
         | 
| 
       50 
51 
     | 
    
         
             
                def list_tokens_for(authenticated_identifier:, flow_identifier: nil)
         
     | 
| 
       51 
52 
     | 
    
         
             
                  raise RuntimeError, 'Failure accessing store' if @store_failure
         
     | 
| 
       52 
     | 
    
         
            -
                   
     | 
| 
      
 53 
     | 
    
         
            +
                  store.select { |x| x[:authenticated_identifier] == authenticated_identifier}
         
     | 
| 
       53 
54 
     | 
    
         
             
                end
         
     | 
| 
       54 
55 
     | 
    
         
             
              end
         
     | 
| 
       55 
56 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: auth_token_store_provider
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Barney de Villiers
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2017-01 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2017-02-01 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: authenticated_client
         
     |