inst_access 0.4.3 → 0.4.4
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/lib/inst_access/token.rb +2 -2
 - data/lib/inst_access/version.rb +1 -1
 - data/spec/inst_access/token_spec.rb +12 -0
 - 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: d5ba1db50c0d9738f9845b2f553e2c3906c9e8bcad0bfb1fbf7d50027b5357f8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 226f184ea24923d9eb95a836ddb6ee7b03258eed74d070bb2686db85c8075984
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7ab6da2741107934b9d52f168a7d88821b850ee60850d7ab2e190531d08c4e3390822faf25f03a0619e3c311f91215315d51d0eac35e67e7d28562b2f8a690ec
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0c2058387c8f73dea54577a38691fc5eca384dbaf9cac6d04398fac3ebf49b2d0a239c4dc72b9fa49d5cca6953660102b155bb2e11fb0347cb76e0fb3be08fa2
         
     | 
    
        data/lib/inst_access/token.rb
    CHANGED
    
    | 
         @@ -159,8 +159,8 @@ module InstAccess 
     | 
|
| 
       159 
159 
     | 
    
         | 
| 
       160 
160 
     | 
    
         
             
                  def token?(string)
         
     | 
| 
       161 
161 
     | 
    
         
             
                    jwt = JSON::JWT.decode(string, :skip_verification)
         
     | 
| 
       162 
     | 
    
         
            -
                     
     | 
| 
       163 
     | 
    
         
            -
                    issuers 
     | 
| 
      
 162 
     | 
    
         
            +
                    InstAccess.configured? && (issuers = InstAccess.config.issuers)
         
     | 
| 
      
 163 
     | 
    
         
            +
                    issuers&.include?(jwt[:iss]) || jwt[:iss] == ISSUER
         
     | 
| 
       164 
164 
     | 
    
         
             
                  rescue StandardError
         
     | 
| 
       165 
165 
     | 
    
         
             
                    false
         
     | 
| 
       166 
166 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/inst_access/version.rb
    CHANGED
    
    
| 
         @@ -63,6 +63,18 @@ describe InstAccess::Token do 
     | 
|
| 
       63 
63 
     | 
    
         
             
                      expect(described_class.token?(unencrypted_token)).to eq(true)
         
     | 
| 
       64 
64 
     | 
    
         
             
                    end
         
     | 
| 
       65 
65 
     | 
    
         
             
                  end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  it 'returns true for JWTs from the default issuer when issuers are configured' do
         
     | 
| 
      
 68 
     | 
    
         
            +
                    token = described_class.for_user(user_uuid: 'user-uuid', account_uuid: 'acct-uuid')
         
     | 
| 
      
 69 
     | 
    
         
            +
                    jws = InstAccess.with_config(signing_key: signing_priv_key) do
         
     | 
| 
      
 70 
     | 
    
         
            +
                      token.to_unencrypted_token_string
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
                    jwt = JSON::JWT.decode(jws, :skip_verification)
         
     | 
| 
      
 73 
     | 
    
         
            +
                    expect(jwt[:iss]).to eq(InstAccess::Token::ISSUER)
         
     | 
| 
      
 74 
     | 
    
         
            +
                    InstAccess.with_config(signing_key: signing_priv_key, issuers: issuers) do
         
     | 
| 
      
 75 
     | 
    
         
            +
                      expect(described_class.token?(jws)).to eq(true)
         
     | 
| 
      
 76 
     | 
    
         
            +
                    end
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
       66 
78 
     | 
    
         
             
                end
         
     | 
| 
       67 
79 
     | 
    
         | 
| 
       68 
80 
     | 
    
         
             
                it 'returns true for an expired InstAccess token' do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: inst_access
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michael Ziwisky
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-09-19 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     |