wwpass-ruby-sdk 0.1.0 → 0.1.1
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/README.md +179 -7
- data/lib/wwpass-ruby-sdk.rb +1 -0
- data/lib/wwpass-ruby-sdk/wwpass_connection.rb +0 -1
- data/wwpass-ruby-sdk.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04a8dbe5f00fd7df2e918d202a0b1c7fb86d4a7f
|
4
|
+
data.tar.gz: eddbdf94e9b08b5404457f69b603a5eb3f50bef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f03ae6d3a0b6bea68ee318ffa60c637bb8cb87f8ac04a4bc645596a4bc448bbf556f2a74d698325f19350184ae1bd53afe29cabaac9ca3f809764eec2068546
|
7
|
+
data.tar.gz: 4e916048850176195e37e8e95b4be3b3cf72ccab206a3cb85f715c4d04d83590c93515fe83bbe23aa50c181f3c0c592e793be30158dfb571a1fd4a4f725b425c
|
data/README.md
CHANGED
@@ -1,8 +1,30 @@
|
|
1
1
|
# WWPass-ruby-sdk
|
2
2
|
|
3
|
-
|
3
|
+
## OVERVIEW
|
4
|
+
### Introduction
|
5
|
+
The *WWPass Ruby SDK* allows a service provider to provide authentication using WWPass. WWPass's Authentication Service is an alternative to or replacement for other authentication methods such as username and password. The Authentication Service works with the WWPass PassKey or WWPass PassKey Lite application on your smart phone.
|
4
6
|
|
5
|
-
|
7
|
+
The **WWPass PassKey** or **WWPass PassKey Lite** is a requirement for user authentication.
|
8
|
+
**PassKey** is a hardware device that enables authentication and access for a given user. A major component of the WWPass authentication capability is the software that supports the PassKey itself. Without this software, requests to an end user to authenticate their identity will fail since this software is used to directly access information stored on the PassKey and communicate with WWPass. To allow Administrator testing of the authentication infrastructure, this client software and an accompanying PassKey is required.
|
9
|
+
**PassKey Lite** is an application for Android and iOS smartphones and tablets. The application is used to scan QR codes to authenticate into WWPass-enabled sites. Alternatively, when browsing with these mobile devices, you can tap the QR code image to authenticate into the site to access protected information directly on your phone or tablet.
|
10
|
+
For more information about how to obtain a PassKey and register it, please refer to the WWPass web site (<http://www.wwpass.com>)
|
11
|
+
|
12
|
+
### Licensing
|
13
|
+
The *WWPass Python SDK* is licensed under the Apache 2.0 license. This license applies to all source code, code examples and accompanying documentation contained herein. You can modify and re-distribute the code with the appropriate attribution. This software is subject to change without notice and should not be construed as a commitment by WWPass.
|
14
|
+
|
15
|
+
You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
|
16
|
+
|
17
|
+
Unless required by applicable law or agreed to in writing, the software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
|
19
|
+
### Customer Assistance
|
20
|
+
If you encounter a problem or have a question, you can contact the WWPass Service Desk as follows:
|
21
|
+
Phone - 1-888-WWPASS1 (+1-888-997-2771)
|
22
|
+
Email - <support@wwpass.com>
|
23
|
+
Online - [Support form](https://www.wwpass.com/support/)
|
24
|
+
|
25
|
+
|
26
|
+
## Quick Start
|
27
|
+
### Installation
|
6
28
|
|
7
29
|
Add this line to your application's Gemfile:
|
8
30
|
|
@@ -18,7 +40,7 @@ Or install it yourself as:
|
|
18
40
|
|
19
41
|
$ gem install wwpass-ruby-sdk
|
20
42
|
|
21
|
-
|
43
|
+
### Usage
|
22
44
|
|
23
45
|
WWPass requires access to the certificates that were installed as part of your WWPass installation as described [here](https://developers.wwpass.com/documentation/get-started). We recommend creating a configuration file like `config/wwpass.yml` with contents like
|
24
46
|
```ruby
|
@@ -38,22 +60,172 @@ production:
|
|
38
60
|
You can then create code (typically in a controller class) that connects to the WWPass Service Provider Front End (spfe) and, for example, fetches a ticket:
|
39
61
|
|
40
62
|
```ruby
|
41
|
-
@connection = WWPassConnection.new(WWPASS_CONFIG[:cert_file], WWPASS_CONFIG[:key_file], WWPASS_CONFIG[:cert_ca])
|
42
63
|
begin
|
43
|
-
@
|
64
|
+
@connection = WWPassRubySDK::WWPassConnection.new(WWPASS_CONFIG[:cert_file], WWPASS_CONFIG[:key_file], WWPASS_CONFIG[:cert_ca])
|
44
65
|
rescue WWPassException => e
|
45
66
|
# Handle exception
|
46
67
|
end
|
68
|
+
@ticket = @connection.get_ticket(':p') # Requires access code entry
|
47
69
|
```
|
48
70
|
|
49
71
|
|
50
|
-
|
72
|
+
### Development
|
51
73
|
|
52
74
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
53
75
|
|
54
76
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
77
|
|
56
|
-
|
78
|
+
### Contributing
|
57
79
|
|
58
80
|
Bug reports and pull requests are welcome on GitHub at https://github.com/wwpass/wwpass-ruby-sdk.
|
59
81
|
|
82
|
+
## Ruby API
|
83
|
+
### WWPassConnection Constructor
|
84
|
+
#### Signature
|
85
|
+
WWPASSConnection(cert_file, key_file, cafile, timeout, spfe_addr)
|
86
|
+
#### Purpose
|
87
|
+
*WWPassConnection* is the class for a WWPass SPFE connection, and a new connection is initiated every time a connection request is made. The WWPass CA certificate is required for validating the SPFE certificate and can be downloaded at <https://developers.wwpass.com/downloads/wwpass.ca>
|
88
|
+
#### Parameters
|
89
|
+
| Name | Description |
|
90
|
+
| --------- | ---------------- |
|
91
|
+
| cert_file | The path to the Service Provider's certificate file. |
|
92
|
+
| key_file | The path to the Service Provider's private key file. |
|
93
|
+
| cafile |The path to the WWPass Service Provider CA certificate. |
|
94
|
+
| timeout | Timeout of requests to SPFE measured in seconds. It is used in all operations. The default is 10 seconds. |
|
95
|
+
| spfe_addr | The hostname or base URL of the SPFE. The default name is <https://spfe.wwpass.com>. |
|
96
|
+
|
97
|
+
### getName
|
98
|
+
#### Signature
|
99
|
+
getName()
|
100
|
+
#### Purpose
|
101
|
+
Gets the service provider name on the certificate which was used initiate this *WWPassConnection* instance.
|
102
|
+
|
103
|
+
#### Returns
|
104
|
+
The service provider name
|
105
|
+
#### Exception (Throw)
|
106
|
+
*WWPassException* is thrown if there is an internal formatting error
|
107
|
+
|
108
|
+
### getTicket
|
109
|
+
#### Signature
|
110
|
+
getTicket(auth_type, ttl)
|
111
|
+
#### Purpose
|
112
|
+
Gets a newly-issued ticket from SPFE. This ticket is required in all other functions.
|
113
|
+
#### Parameters
|
114
|
+
| Name | Description |
|
115
|
+
| ------- | -------------- |
|
116
|
+
| auth_type | Defines which credentials will be asked of the user to authenticate this ticket. The values may be any combination of following letters: ‘p’ — to ask for PassKey and access code; ‘s’ — to generate cryptographically secure random number that would be available both to client and Service Provider; or empty string to ask for PassKey only (default). |
|
117
|
+
| ttl |The period in seconds for the ticket to remain valid since issuance. The default is 120 seconds. |
|
118
|
+
|
119
|
+
#### Returns
|
120
|
+
Ticket string
|
121
|
+
|
122
|
+
### getPUID
|
123
|
+
#### Signature
|
124
|
+
getPUID(ticket, auth_type)
|
125
|
+
#### Purpose
|
126
|
+
Gets the id of the user from the Service Provider Front End. This ID is unique for each Service Provider.
|
127
|
+
#### Parameters
|
128
|
+
| Name | Description |
|
129
|
+
| ------- | -------------- |
|
130
|
+
| ticket | The authenticated ticket. |
|
131
|
+
| auth_type | Defines which credentials will be asked of the user to authenticate this ticket. The values may be any combination of following letters: ‘p’ — to ask for PassKey and access code; ‘s’ — to generate cryptographically secure random number that would be available both to client and Service Provider; or empty string to ask for PassKey only (default). |
|
132
|
+
|
133
|
+
#### Returns
|
134
|
+
User ID
|
135
|
+
|
136
|
+
### putTicket
|
137
|
+
#### Signature
|
138
|
+
putTicket(ticket, ttl, auth_type)
|
139
|
+
#### Purpose
|
140
|
+
Checks the authentication of the ticket and may issue a new ticket from SPFE. All subsequent operations should use a returned ticket instead of one provided to *putTicket*.
|
141
|
+
#### Parameters
|
142
|
+
| Name | Description |
|
143
|
+
| ------- | -------------- |
|
144
|
+
| ticket | The ticket to validate. |
|
145
|
+
| ttl | The period in seconds for the ticket to remain valid since issuance. The default is 120 seconds. |
|
146
|
+
| auth_type | Defines which credentials will be asked of the user to authenticate this ticket. The values may be any combination of following letters: ‘p’ — to ask for PassKey and access code; ‘s’ — to generate cryptographically secure random number that would be available both to client and Service Provider; or empty string to ask for PassKey only (default). |
|
147
|
+
|
148
|
+
#### Returns
|
149
|
+
Possibly new ticket
|
150
|
+
|
151
|
+
The new ticket should be used in further operations with the SPFE.
|
152
|
+
|
153
|
+
### readData()
|
154
|
+
#### Signature
|
155
|
+
readData(ticket, container)
|
156
|
+
#### Purpose
|
157
|
+
Requests data stored in the user’s data container.
|
158
|
+
#### Parameters
|
159
|
+
| Name | Description |
|
160
|
+
| ------- | -------------- |
|
161
|
+
| ticket | The authenticated ticket issued by the SPFE. |
|
162
|
+
| container | Arbitrary string (only the first 32 bytes are significant) identifying the user’s data container. |
|
163
|
+
|
164
|
+
#### Returns
|
165
|
+
Data string
|
166
|
+
|
167
|
+
### readDataAndLock()
|
168
|
+
#### Signature
|
169
|
+
readDataAndLock(ticket, lock_timeout, container)
|
170
|
+
#### Purpose
|
171
|
+
Requests data stored in the user’s data container and tries to atomically lock an associated lock.
|
172
|
+
#### Parameters
|
173
|
+
| Name | Description |
|
174
|
+
| ------- | -------------- |
|
175
|
+
| ticket | The authenticated ticket issued by the SPFE. |
|
176
|
+
| lock_timeout | The period in seconds for the data container to remain protected from the new data being accessed. |
|
177
|
+
| container | Arbitrary string (only the first 32 bytes are significant) identifying the user’s data container. |
|
178
|
+
|
179
|
+
#### Returns
|
180
|
+
Data string
|
181
|
+
|
182
|
+
### writeData()
|
183
|
+
#### Signature
|
184
|
+
writeData(ticket, data, container)
|
185
|
+
#### Purpose
|
186
|
+
Write data into the user’s data container.
|
187
|
+
#### Parameters
|
188
|
+
| Name | Description |
|
189
|
+
| ------- | -------------- |
|
190
|
+
| ticket | The authenticated ticket issued by the SPFE. |
|
191
|
+
| data | The string to write into the container. |
|
192
|
+
| container | Arbitrary string (only the first 32 bytes are significant) identifying the user’s data container. |
|
193
|
+
|
194
|
+
#### Returns
|
195
|
+
`(True, None)` or
|
196
|
+
`(False, <error message>)`
|
197
|
+
|
198
|
+
### writeDataAndUnlock
|
199
|
+
#### Signature
|
200
|
+
writeDataAndUnlock(ticket, data, container)
|
201
|
+
#### Purpose
|
202
|
+
Writes data into the user's data container and unlocks an associated lock. If the lock is already unlocked, the write will succeed, but the function will return an appropriate error.
|
203
|
+
#### Parameters
|
204
|
+
| Name | Description |
|
205
|
+
| ------- | -------------- |
|
206
|
+
| ticket | The authenticated ticket issued by the SPFE. |
|
207
|
+
| data | The string to write into the container. |
|
208
|
+
| container | Arbitrary string (only the first 32 bytes are significant) identifying the user’s data container. |
|
209
|
+
|
210
|
+
### lock
|
211
|
+
#### Signature
|
212
|
+
lock(ticket, lockTimeout, lockid)
|
213
|
+
#### Purpose
|
214
|
+
Tries to lock a lock identified by the user (by authenticated ticket) and lock ID.
|
215
|
+
#### Parameters
|
216
|
+
| Name | Description |
|
217
|
+
| ------- | -------------- |
|
218
|
+
| ticket | The authenticated ticket issued by the SPFE. |
|
219
|
+
| lockTimeout | The period in seconds for the data container to remain protected from the new data being accessed. |
|
220
|
+
| lockid | The arbitrary string (only the first 32 bytes are significant) identifying the lock. |
|
221
|
+
|
222
|
+
### unlock
|
223
|
+
#### Signature
|
224
|
+
unlock(ticket, lockid)
|
225
|
+
#### Purpose
|
226
|
+
Tries to unlock a lock identified by the user (by authenticated ticket) and lock ID.
|
227
|
+
##### Parameters
|
228
|
+
| Name | Description |
|
229
|
+
| ------- | -------------- |
|
230
|
+
| ticket | The authenticated ticket issued by the SPFE. |
|
231
|
+
| lockid | The arbitrary string (only the first 32 bytes are significant) identifying the lock. |
|
data/lib/wwpass-ruby-sdk.rb
CHANGED
data/wwpass-ruby-sdk.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'wwpass-ruby-sdk/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'wwpass-ruby-sdk'
|
8
|
-
spec.version = '0.1.
|
8
|
+
spec.version = '0.1.1'
|
9
9
|
spec.authors = ['Stanislav Panyushkin']
|
10
10
|
spec.email = ['opensource@wwpass.com']
|
11
11
|
spec.license = 'Apache-2.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wwpass-ruby-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav Panyushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|