omniauth-idcard 0.1.0 → 0.2.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.
- data/lib/omniauth/strategies/idcard.rb +17 -5
 - data/lib/omniauth-idcard/version.rb +1 -1
 - metadata +10 -5
 
| 
         @@ -41,15 +41,27 @@ module OmniAuth 
     | 
|
| 
       41 
41 
     | 
    
         
             
                    end
         
     | 
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
      
 44 
     | 
    
         
            +
                  def unescape(value)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    value.gsub( /\\(?:([nevfbart\\])|0?x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/ ) {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    if $3
         
     | 
| 
      
 47 
     | 
    
         
            +
                      ["#$3".hex ].pack('U*')
         
     | 
| 
      
 48 
     | 
    
         
            +
                    elsif $2
         
     | 
| 
      
 49 
     | 
    
         
            +
                      [$2].pack( "H2" )
         
     | 
| 
      
 50 
     | 
    
         
            +
                    else
         
     | 
| 
      
 51 
     | 
    
         
            +
                      UNESCAPES[$1]
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  }
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
       44 
56 
     | 
    
         
             
                  def parse_client_certificate(data)
         
     | 
| 
       45 
57 
     | 
    
         
             
                    cert = OpenSSL::X509::Certificate.new(data)
         
     | 
| 
       46 
     | 
    
         
            -
                    subject_dn = cert.subject.to_s.scan(/./mu) {|s| s[0].chr}
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
                    subject_dn = unescape(cert.subject.to_s).unpack("C*").pack("U*").scan(/./mu) {|s| s[0].chr }
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       48 
60 
     | 
    
         
             
                    debug "Subject DN: #{subject_dn}"
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                    subject_dn.split('/').inject(Hash.new) do |memo, part|
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                    subject_dn.mb_chars.split('/').inject(Hash.new) do |memo, part|
         
     | 
| 
       51 
63 
     | 
    
         
             
                      item = part.split('=')
         
     | 
| 
       52 
     | 
    
         
            -
                      memo[item.first] = item.last
         
     | 
| 
      
 64 
     | 
    
         
            +
                      memo[item.first.to_s] = item.last
         
     | 
| 
       53 
65 
     | 
    
         
             
                      memo
         
     | 
| 
       54 
66 
     | 
    
         
             
                    end
         
     | 
| 
       55 
67 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: omniauth-idcard
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,11 +9,11 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-01-02 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: omniauth-oauth
         
     | 
| 
       16 
     | 
    
         
            -
              requirement:  
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -21,7 +21,12 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: '1.0'
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements:  
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
       25 
30 
     | 
    
         
             
            description: OmniAuth strategy for Estonian ID-Card
         
     | 
| 
       26 
31 
     | 
    
         
             
            email:
         
     | 
| 
       27 
32 
     | 
    
         
             
            - tarmo.talu@gmail.com
         
     | 
| 
         @@ -56,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       56 
61 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       57 
62 
     | 
    
         
             
            requirements: []
         
     | 
| 
       58 
63 
     | 
    
         
             
            rubyforge_project: omniauth-idcard
         
     | 
| 
       59 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 64 
     | 
    
         
            +
            rubygems_version: 1.8.24
         
     | 
| 
       60 
65 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       61 
66 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       62 
67 
     | 
    
         
             
            summary: OmniAuth strategy for Estonian ID-Card
         
     |