oauth_token_verifier 0.1.2 → 0.1.3
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/.travis.yml +3 -0
- data/README.md +11 -1
- data/lib/oauth_token_verifier/configuration.rb +5 -5
- data/lib/oauth_token_verifier/providers/facebook.rb +2 -3
- data/lib/oauth_token_verifier/providers/google.rb +2 -1
- data/lib/oauth_token_verifier/providers/vk.rb +2 -3
- data/lib/oauth_token_verifier/version.rb +1 -1
- data/lib/oauth_token_verifier.rb +1 -1
- data/oauth2_flow.png +0 -0
- data/oauth_token_verifier.gemspec +1 -0
- metadata +17 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f19e2c2729c75720239d18a237217b8896779078
         | 
| 4 | 
            +
              data.tar.gz: ab225a1f50c8ff7250b06d20a7ace3f87bb94dce
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7b0b62594d4f6174c12b9ed2e1a3b9191abf3b3474b0788a9214962fdcef592ba3b7e9e526a7c9550b4c8b8dceec4640c88216dd018147ca4e5ea7e0fee99a5d
         | 
| 7 | 
            +
              data.tar.gz: ccd61cee60a1b3cd57d65625f02df6e7d8fa7e455abd30d52108580899c315bd5898fc03c2c4dd58473fb30f8767d3cf2fe5019288ee4f2b503f0edf6f4bdd95
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,12 +1,22 @@ | |
| 1 | 
            +
            [](https://travis-ci.org/Shkrt/oauth_token_verifier)
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            # OauthTokenVerifier
         | 
| 2 4 |  | 
| 3 5 | 
             
            This library helps to verify oauth2 access tokens that have been obtained from third party, i.e. mobile application.
         | 
| 4 6 |  | 
| 7 | 
            +
            Example of oauth2 flow using this library is shown below:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            
         | 
| 10 | 
            +
             | 
| 5 11 | 
             
            ## Installation
         | 
| 6 12 |  | 
| 13 | 
            +
            install manually:
         | 
| 14 | 
            +
             | 
| 7 15 | 
             
            `gem install oauth_token_verifier`
         | 
| 8 16 |  | 
| 9 | 
            -
             | 
| 17 | 
            +
            or using Gemfile:
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            `gem 'oauth_token_verifier'`
         | 
| 10 20 |  | 
| 11 21 | 
             
            ## Configuration
         | 
| 12 22 |  | 
| @@ -7,17 +7,17 @@ module OauthTokenVerifier | |
| 7 7 | 
             
                  @enabled_providers = []
         | 
| 8 8 |  | 
| 9 9 | 
             
                  @google = ProviderSettings.new({
         | 
| 10 | 
            -
                     | 
| 11 | 
            -
                     | 
| 10 | 
            +
                    first_name: :given_name,
         | 
| 11 | 
            +
                    last_name: :family_name
         | 
| 12 12 | 
             
                  }, 'google', 'email')
         | 
| 13 13 |  | 
| 14 14 | 
             
                  @vk = ProviderSettings.new({
         | 
| 15 | 
            -
                     | 
| 16 | 
            -
                     | 
| 15 | 
            +
                    first_name: :first_name,
         | 
| 16 | 
            +
                    last_name: :last_name
         | 
| 17 17 | 
             
                  }, 'vk', 'uid')
         | 
| 18 18 |  | 
| 19 19 | 
             
                  @facebook = ProviderSettings.new({
         | 
| 20 | 
            -
                     | 
| 20 | 
            +
                    first_name: :name,
         | 
| 21 21 | 
             
                  }, 'facebook', 'id')
         | 
| 22 22 | 
             
                end
         | 
| 23 23 | 
             
              end
         | 
| @@ -22,11 +22,10 @@ module OauthTokenVerifier::Providers | |
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 24 | 
             
                def build_uri(token)
         | 
| 25 | 
            +
                  params = { access_token: token, fields: @request_fields }
         | 
| 25 26 | 
             
                  URI::HTTPS.build(host: 'graph.facebook.com',
         | 
| 26 27 | 
             
                                   path: '/me',
         | 
| 27 | 
            -
                                   query:  | 
| 28 | 
            -
                                            fields: @request_fields
         | 
| 29 | 
            -
                                          }.to_query)
         | 
| 28 | 
            +
                                   query: URI.encode_www_form(params))
         | 
| 30 29 | 
             
                end
         | 
| 31 30 |  | 
| 32 31 | 
             
                def check_response(uri)
         | 
| @@ -21,9 +21,10 @@ module OauthTokenVerifier::Providers | |
| 21 21 | 
             
                end
         | 
| 22 22 |  | 
| 23 23 | 
             
                def build_uri(token)
         | 
| 24 | 
            +
                  params = { id_token: token }
         | 
| 24 25 | 
             
                  URI::HTTPS.build(host: 'www.googleapis.com',
         | 
| 25 26 | 
             
                                   path: '/oauth2/v3/tokeninfo',
         | 
| 26 | 
            -
                                   query:  | 
| 27 | 
            +
                                   query: URI.encode_www_form(params))
         | 
| 27 28 | 
             
                end
         | 
| 28 29 |  | 
| 29 30 | 
             
                def check_response(uri)
         | 
| @@ -22,11 +22,10 @@ module OauthTokenVerifier::Providers | |
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 24 | 
             
                def build_uri(token)
         | 
| 25 | 
            +
                  params = { access_token: token, fields: @request_fields }
         | 
| 25 26 | 
             
                  URI::HTTPS.build(host: 'api.vk.com',
         | 
| 26 27 | 
             
                                   path: '/method/users.get',
         | 
| 27 | 
            -
                                   query:  | 
| 28 | 
            -
                                            fields: @request_fields
         | 
| 29 | 
            -
                                          }.to_query)
         | 
| 28 | 
            +
                                   query: URI.encode_www_form(params))
         | 
| 30 29 | 
             
                end
         | 
| 31 30 |  | 
| 32 31 | 
             
                def check_response(uri)
         | 
    
        data/lib/oauth_token_verifier.rb
    CHANGED
    
    | @@ -52,7 +52,7 @@ module OauthTokenVerifier | |
| 52 52 | 
             
                    raise NoProviderFoundError, "Oauth provider #{name} is not enabled in configuration"
         | 
| 53 53 | 
             
                  end
         | 
| 54 54 |  | 
| 55 | 
            -
                  "OauthTokenVerifier::Providers::#{name.to_s. | 
| 55 | 
            +
                  Object.const_get("OauthTokenVerifier::Providers::#{name.to_s.capitalize}")
         | 
| 56 56 | 
             
                end
         | 
| 57 57 | 
             
              end
         | 
| 58 58 | 
             
            end
         | 
    
        data/oauth2_flow.png
    ADDED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: oauth_token_verifier
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Shkrt
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-07- | 
| 11 | 
            +
            date: 2017-07-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -52,6 +52,20 @@ dependencies: | |
| 52 52 | 
             
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '3.0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: webmock
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ">="
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ">="
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 55 69 | 
             
            description: This library provides possibility of verifying oauth2 access tokens obtained
         | 
| 56 70 | 
             
              from third party
         | 
| 57 71 | 
             
            email:
         | 
| @@ -76,6 +90,7 @@ files: | |
| 76 90 | 
             
            - lib/oauth_token_verifier/providers/google.rb
         | 
| 77 91 | 
             
            - lib/oauth_token_verifier/providers/vk.rb
         | 
| 78 92 | 
             
            - lib/oauth_token_verifier/version.rb
         | 
| 93 | 
            +
            - oauth2_flow.png
         | 
| 79 94 | 
             
            - oauth_token_verifier.gemspec
         | 
| 80 95 | 
             
            homepage: https://github.com/Shkrt/oauth_token_verifier
         | 
| 81 96 | 
             
            licenses:
         |