omniauth-saml-rmunify 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGYyZTEwMzliMWZiZTNlMmRhYzE5M2Q5Y2VjOWMxNjEyZWNlMDA5OA==
4
+ MjM3ZDIyODhkZmE3YmYyZTNjZWRkNWM2N2Q0NTgxYzUyNmE4Y2JlNg==
5
5
  data.tar.gz: !binary |-
6
- ZTE2Zjk5MzE2OTY0ZTY5OWY1YjIwOWI3MTllY2JmMDQ4NGQ4YjUyNw==
6
+ OThlYTM2MzM3NGY4OWUzNGU5NDk2YmUzNjQ2MDQ1MjIyY2ZhMDBiOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjJiMzk2Y2VhNjVlMDIyYjRkMTM4MmI5Zjc5OWUwMjAwNDkwNjc4ZWNhOTMz
10
- MWVmZGE2ZTk5MWQxMWUyMmI2MzNmOGE1NjIwMzI5MzFiZDFhMTQwM2IyZjQw
11
- ZDllODA0YWI2OTE4NjI0MDgyZjExMmVhMTA3MjEzMmQ1NDhiNDI=
9
+ ZmU3YzFhNjA2MWFmYmE4OGNmNzAwYTE1NmM4MjI1NjRiNGRkM2ZhMGFjNjll
10
+ MDYyMGVlMDQ1YWQzYjIzZGVlN2E4MDU5YWRjODkzMGRmMDY5MjlmMGVmMjU3
11
+ YTE5MTVhN2M2NDgyNmU2NjZjN2UxMGE0OWY3NTFlOGY3YTBhNTk=
12
12
  data.tar.gz: !binary |-
13
- OTZmMTkzYjY0ODkxZTFiMzNmZGZhY2UwNjI3ZjUzYjJjOGE2NjQ2OTczNTg3
14
- NTJmYmRhZTA3NGUyNjdlZWNmZWJhY2FjMjhmNzEzMGQxNjVlYjI2NjFhOWZm
15
- ZjkzZWY5MzYyN2Q1Nzc4OTNkYWI5ZDFjNjE1YzI0MTYzOTUzYTA=
13
+ NmUyMzI4ODVhZGRhOGQ4NjhiOWU4MzA2Y2IyYjE5MThiNTVlMWQ0NmY4ZTFk
14
+ MDBjZTJhNzI1YmNjYWVhZTIxOTBmNzAyOWIxM2U2YjAwODM2MzljYzEyODIw
15
+ Yzc1YzQ0MjkzNWI3MjNmODQ0MTE2OWJhMWRmMmVhM2E4NWVhZTM=
@@ -6,6 +6,13 @@ https://github.com/hampei/omniauth-saml-rmunify
6
6
 
7
7
  ## master
8
8
 
9
+ ## 2.0.0 (2014-02-17)
10
+
11
+ * Added app_licence underscore hash keys.
12
+ * Removed app_licence camelcased keys.
13
+ * Added app_name, package_name, school_type and term to the licence hash.
14
+ * Made is_unify_admin a boolean.
15
+ * Made licence.is_connector and licence.is_trial booleans.
9
16
 
10
17
  ## 1.0.0 (2014-02-15)
11
18
 
data/README.md CHANGED
@@ -6,7 +6,7 @@ https://github.com/hampei/omniauth-saml-rmunify
6
6
 
7
7
  * It's a simple subclass of omniauth-saml with a rm unify specific info hash.
8
8
  * Take a look at [rm attributes](http://dev.rmunify.com/reference/understanding-rm-unify/user-attributes.aspx) for descriptions.
9
- * The attribute names have been taken from the manage-app/single-sign-on/saml-p page, underscored for you convenience.
9
+ * The attribute names have been taken from the manage-app/single-sign-on/saml-p page, underscored for your convenience.
10
10
  * Read the [list of info attributes](https://github.com/hampei/omniauth-saml-rmunify/blob/master/lib/omniauth/strategies/saml-rmunify.rb) for what is available.
11
11
 
12
12
  ## Requirements
@@ -37,6 +37,17 @@ Rails.application.config.middleware.use OmniAuth::Builder do
37
37
  end
38
38
  ```
39
39
 
40
+ In your callback:
41
+
42
+ ```ruby
43
+ def saml_rmunify
44
+ uid = request.env["omniauth.auth"].uid
45
+ info = request.env["omniauth.auth"].info
46
+ info.licence # {"is_trial"=>false, "is_connector"=>false, "description"=>".../premium/Pri/1y/RMUnify",
47
+ # "app_name"=>"...", "package_name"=>"premium", "school_type"=>"Pri", "term"=>"1y"}
48
+ end
49
+ ```
50
+
40
51
  ## Authors
41
52
 
42
53
  Authored by Henk van der Veen.
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module SAMLRMUnify
3
- VERSION = '1.0.0'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ module OmniAuth
27
27
  :display_name => @attributes['urn:oid:2.16.840.1.113730.3.1.241'],
28
28
  :role => @attributes['http://schemas.microsoft.com/ws/2008/06/identity/claims/role'],
29
29
  :scope_affiliation => @attributes['urn:oid:1.3.6.1.4.1.5923.1.1.1.9'],
30
- :is_unify_admin => @attributes['http://schemas.rm.com/identity/claims/isunifyadmin'],
30
+ :is_unify_admin => @attributes['http://schemas.rm.com/identity/claims/isunifyadmin'] == 'True',
31
31
  :year_of_entry => @attributes['http://schemas.rm.com/identity/claims/yearofentry'],
32
32
  :app_licence => licence,
33
33
  :app_user_id => @attributes['http://schemas.rm.com/identity/claims/appuserid'],
@@ -35,9 +35,27 @@ module OmniAuth
35
35
  }
36
36
  end
37
37
 
38
- private def licence
38
+ private
39
+
40
+ def licence
39
41
  licence_str = @attributes['http://schemas.rm.com/identity/claims/applicence']
40
- licence = Hash[licence_str[1..-2].split('|').map{|kv| kv.split(':')}]
42
+ licence = Hash[licence_str[1..-2].split('|').map{|kv|
43
+ (k,v) = kv.split(':')
44
+ [k.underscore, v]
45
+ }]
46
+ licence['is_trial'] = licence['is_trial'] == 'True'
47
+ licence['is_connector'] = licence['is_connector'] == 'True'
48
+ licence.merge!(licence_description(licence))
49
+ end
50
+
51
+ def licence_description(licence)
52
+ desc = licence['description'].split('/')
53
+ {
54
+ :app_name => desc[0],
55
+ :package_name => desc[1],
56
+ :school_type => desc[2],
57
+ :term => desc[3]
58
+ }
41
59
  end
42
60
  end
43
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-saml-rmunify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henk van der Veen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-14 00:00:00.000000000 Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-saml