omniauth-idcat_mobil 0.2.1 → 0.2.2
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/.ruby-version +1 -1
 - data/CHANGELOG.md +4 -0
 - data/lib/omniauth/idcat_mobil/version.rb +1 -1
 - data/lib/omniauth/strategies/idcat_mobil.rb +15 -11
 - 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: 37d52ae58802955d43e15d2492906f84dba0b4a9f6a042436fad68ebc1093f33
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 131dc83ac5dc43b4ee47d66ff3213341394ae01469273ef6adb8580e72be6129
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 129387454f49df2062c14dce03ba6a5720b1be7fa11697f28026096d38da62ebcbbc62ff4953c5833cc7269a398dcb9bf8ef0a99a152bb4d61c4b0a7030d5707
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b6dea50779fdd2b3835e6944b0dee4b58bccb9907d036fa6e3d1d9189c77f402525057399acb6085988abff36145dccf971adca0144be0801bb8729095e51268
         
     | 
    
        data/.ruby-version
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            2.7. 
     | 
| 
      
 1 
     | 
    
         
            +
            2.7.5
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -77,8 +77,8 @@ module OmniAuth 
     | 
|
| 
       77 
77 
     | 
    
         
             
                  # 
         
     | 
| 
       78 
78 
     | 
    
         
             
                  # We're overriding solely to log.
         
     | 
| 
       79 
79 
     | 
    
         
             
                  def request_phase
         
     | 
| 
       80 
     | 
    
         
            -
                     
     | 
| 
       81 
     | 
    
         
            -
                     
     | 
| 
      
 80 
     | 
    
         
            +
                    idcat_log("In `request_phase`, with params: redirect_uri=>#{callback_url}, options=>#{options.authorize_params}")
         
     | 
| 
      
 81 
     | 
    
         
            +
                    idcat_log("`request_phase`, redirecting the user to AOC...")
         
     | 
| 
       82 
82 
     | 
    
         
             
                    super
         
     | 
| 
       83 
83 
     | 
    
         
             
                  end
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
         @@ -88,18 +88,18 @@ module OmniAuth 
     | 
|
| 
       88 
88 
     | 
    
         
             
                  # In case of success we still have to ask the authentication provider for the access_token.
         
     | 
| 
       89 
89 
     | 
    
         
             
                  # That's what we do in this callback.
         
     | 
| 
       90 
90 
     | 
    
         
             
                  def callback_phase
         
     | 
| 
       91 
     | 
    
         
            -
                     
     | 
| 
       92 
     | 
    
         
            -
                     
     | 
| 
      
 91 
     | 
    
         
            +
                    idcat_log("In `callback_phase` with request params: #{request.params}")
         
     | 
| 
      
 92 
     | 
    
         
            +
                    idcat_log("Both should be equal otherwise a 'CSRF detected' error is raised: params state[#{request.params["state"]}] =? [#{session.delete("omniauth.state")}] session state.")
         
     | 
| 
       93 
93 
     | 
    
         
             
                    super
         
     | 
| 
       94 
94 
     | 
    
         
             
                  end
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
96 
     | 
    
         
             
                  def raw_info
         
     | 
| 
       97 
     | 
    
         
            -
                     
     | 
| 
       98 
     | 
    
         
            -
                     
     | 
| 
      
 97 
     | 
    
         
            +
                    idcat_log("Access token response was: #{access_token.response}")
         
     | 
| 
      
 98 
     | 
    
         
            +
                    idcat_log("Performing getUserInfo...")
         
     | 
| 
       99 
99 
     | 
    
         
             
                    unless @raw_info
         
     | 
| 
       100 
100 
     | 
    
         
             
                      response= access_token.get(options.user_info_path)
         
     | 
| 
       101 
101 
     | 
    
         
             
                      result= %i(status headers body).collect  {|m| response.send(m)}
         
     | 
| 
       102 
     | 
    
         
            -
                       
     | 
| 
      
 102 
     | 
    
         
            +
                      idcat_log("getUserInfo response status/headers/body: #{result}")
         
     | 
| 
       103 
103 
     | 
    
         
             
                      @raw_info= response.parsed
         
     | 
| 
       104 
104 
     | 
    
         
             
                      # Logout to avoid problems with IdCat mòbil's cookie session when trying to login again.
         
     | 
| 
       105 
105 
     | 
    
         
             
                      logout_url= URI.join(options.site, "/o/oauth2/logout?token=#{access_token.token}").to_s
         
     | 
| 
         @@ -114,12 +114,16 @@ module OmniAuth 
     | 
|
| 
       114 
114 
     | 
    
         
             
                    full_host + script_name + callback_path
         
     | 
| 
       115 
115 
     | 
    
         
             
                  end
         
     | 
| 
       116 
116 
     | 
    
         | 
| 
       117 
     | 
    
         
            -
                   
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 117 
     | 
    
         
            +
                  # --------------------------------------------------
         
     | 
| 
      
 118 
     | 
    
         
            +
                  private
         
     | 
| 
      
 119 
     | 
    
         
            +
                  # --------------------------------------------------
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                  def idcat_log(msg)
         
     | 
| 
      
 122 
     | 
    
         
            +
                    idcat_logger.debug(msg)
         
     | 
| 
       119 
123 
     | 
    
         
             
                  end
         
     | 
| 
       120 
124 
     | 
    
         | 
| 
       121 
     | 
    
         
            -
                  def  
     | 
| 
       122 
     | 
    
         
            -
                    @ 
     | 
| 
      
 125 
     | 
    
         
            +
                  def idcat_logger
         
     | 
| 
      
 126 
     | 
    
         
            +
                    @idcat_logger||= defined?(Rails.logger) ? Rails.logger : Logger.new(STDOUT, progname: 'idcat_mobil')
         
     | 
| 
       123 
127 
     | 
    
         
             
                  end
         
     | 
| 
       124 
128 
     | 
    
         
             
                end
         
     | 
| 
       125 
129 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: omniauth-idcat_mobil
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Oliver Valls
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-01-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: omniauth
         
     |