socky-authenticator 0.5.0.beta5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/Gemfile +2 -0
- data/README.md +35 -9
- data/lib/socky/authenticator/version.rb +2 -2
- metadata +13 -14
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,65 @@
|
|
1
|
-
# Socky Authentication Module
|
1
|
+
# Socky Authentication Module [![](http://travis-ci.org/socky/socky-authenticator-ruby.png)](http://travis-ci.org/socky/socky-authenticator-ruby)
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
5
|
-
|
5
|
+
``` bash
|
6
|
+
$ gem install socky-authenticator
|
7
|
+
```
|
6
8
|
|
7
9
|
## Usage
|
8
10
|
|
9
11
|
First require authenticator:
|
10
12
|
|
11
|
-
|
13
|
+
``` ruby
|
14
|
+
require 'socky/authenticator'
|
15
|
+
```
|
12
16
|
|
13
17
|
After that call:
|
14
18
|
|
15
|
-
|
19
|
+
``` ruby
|
20
|
+
Socky::Authenticator.authenticate(<data>)
|
21
|
+
```
|
16
22
|
|
17
23
|
where \<data\> is Socky Client authentication data in Hash or JSON-encoded Hash format.
|
18
24
|
|
19
25
|
In return you will receive authentication Hash in format:
|
20
|
-
|
21
|
-
|
26
|
+
|
27
|
+
``` ruby
|
28
|
+
{ 'auth' => <auth_data> }
|
29
|
+
```
|
22
30
|
|
23
31
|
If any error occurs then authenticator will raise ArgumentError with explanation.
|
24
32
|
|
25
33
|
If you are validating presence channel then except auth data you will receive user data in JSON-encoded format:
|
26
34
|
|
27
|
-
|
35
|
+
``` ruby
|
36
|
+
{ 'auth' => <auth_dat>, 'data' => <json-encoded_user_data> }
|
37
|
+
```
|
28
38
|
|
29
39
|
## Configuration
|
30
40
|
|
31
41
|
Before authenticating request you will need to provide application secret. If you are using only one Socky application in code then you can set it once using:
|
32
42
|
|
33
|
-
|
43
|
+
``` ruby
|
44
|
+
Socky::Authenticator.secret = <secret>
|
45
|
+
```
|
34
46
|
|
35
47
|
Otherwise you will need to provide secret each time when authenticating data.
|
36
48
|
|
37
49
|
Except of that you can enable or disable authenticaton of user rights - if disabled(default) then user will not be able to change their rights. Full version of authenticator call will look like that:
|
38
50
|
|
39
|
-
|
51
|
+
``` ruby
|
52
|
+
Socky::Authenticator.authenticate(<data>, :allow_changing_rights => true, :secret => 'mysecret')
|
53
|
+
```
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
(The MIT License)
|
58
|
+
|
59
|
+
Copyright (c) 2011 Bernard Potocki
|
60
|
+
|
61
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
62
|
+
|
63
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
64
|
+
|
65
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
metadata
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socky-authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bernard Potocki
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2012-02-16 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: json
|
17
|
-
requirement: &
|
16
|
+
requirement: &70335338660300 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: '0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *70335338660300
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: ruby-hmac
|
28
|
-
requirement: &
|
27
|
+
requirement: &70335338658640 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: '0'
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *70335338658640
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: rspec
|
39
|
-
requirement: &
|
38
|
+
requirement: &70335338657580 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ~>
|
@@ -44,7 +43,7 @@ dependencies:
|
|
44
43
|
version: '2.0'
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *70335338657580
|
48
47
|
description: Socky is a WebSocket-based framework for realtime web applications.
|
49
48
|
email:
|
50
49
|
- bernard.potocki@imanel.org
|
@@ -53,6 +52,7 @@ extensions: []
|
|
53
52
|
extra_rdoc_files: []
|
54
53
|
files:
|
55
54
|
- .gitignore
|
55
|
+
- .travis.yml
|
56
56
|
- Gemfile
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
@@ -62,7 +62,6 @@ files:
|
|
62
62
|
- socky-authenticator.gemspec
|
63
63
|
- spec/authenticator_spec.rb
|
64
64
|
- spec/spec_helper.rb
|
65
|
-
has_rdoc: true
|
66
65
|
homepage: http://socky.org
|
67
66
|
licenses: []
|
68
67
|
post_install_message:
|
@@ -78,12 +77,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
78
|
none: false
|
80
79
|
requirements:
|
81
|
-
- - ! '
|
80
|
+
- - ! '>='
|
82
81
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
82
|
+
version: '0'
|
84
83
|
requirements: []
|
85
84
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.8.11
|
87
86
|
signing_key:
|
88
87
|
specification_version: 3
|
89
88
|
summary: Socky - Authentication Module
|