passageidentity 0.2.3 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +18 -61
- data/docs/custom/AuthApi.md +141 -0
- data/docs/custom/ClientApi.md +107 -0
- data/docs/custom/UserApi.md +419 -0
- data/docs/generated/AppInfo.md +94 -0
- data/docs/generated/AppResponse.md +18 -0
- data/docs/generated/AppsApi.md +77 -0
- data/docs/generated/AuthMethods.md +22 -0
- data/docs/generated/CreateMagicLinkRequest.md +36 -0
- data/docs/generated/CreateUserRequest.md +22 -0
- data/docs/generated/ElementCustomization.md +56 -0
- data/docs/generated/FontFamily.md +15 -0
- data/docs/generated/LayoutConfig.md +26 -0
- data/docs/generated/Layouts.md +20 -0
- data/docs/generated/ListDevicesResponse.md +18 -0
- data/docs/generated/MagicLink.md +36 -0
- data/docs/generated/MagicLinkAuthMethod.md +22 -0
- data/docs/generated/MagicLinkChannel.md +15 -0
- data/docs/generated/MagicLinkResponse.md +18 -0
- data/docs/generated/MagicLinkType.md +15 -0
- data/docs/generated/MagicLinksApi.md +79 -0
- data/docs/generated/Model400Error.md +20 -0
- data/docs/generated/Model401Error.md +20 -0
- data/docs/generated/Model404Error.md +20 -0
- data/docs/generated/Model500Error.md +20 -0
- data/docs/generated/OtpAuthMethod.md +22 -0
- data/docs/generated/PasskeysAuthMethod.md +18 -0
- data/docs/generated/Technologies.md +15 -0
- data/docs/generated/TokensApi.md +78 -0
- data/docs/generated/TtlDisplayUnit.md +15 -0
- data/docs/generated/UpdateMagicLinkAuthMethod.md +22 -0
- data/docs/generated/UpdateOtpAuthMethod.md +22 -0
- data/docs/generated/UpdatePasskeysAuthMethod.md +18 -0
- data/docs/generated/UpdateUserRequest.md +22 -0
- data/docs/generated/UserDevicesApi.md +152 -0
- data/docs/generated/UserEventInfo.md +26 -0
- data/docs/generated/UserInfo.md +46 -0
- data/docs/generated/UserMetadataField.md +28 -0
- data/docs/generated/UserMetadataFieldType.md +15 -0
- data/docs/generated/UserResponse.md +18 -0
- data/docs/generated/UserStatus.md +15 -0
- data/docs/generated/UsersApi.md +440 -0
- data/docs/generated/WebAuthnDevices.md +34 -0
- data/docs/generated/WebAuthnIcons.md +20 -0
- data/docs/generated/WebAuthnType.md +15 -0
- data/generate.sh +31 -0
- data/lib/openapi_client/api/apps_api.rb +85 -0
- data/lib/openapi_client/api/magic_links_api.rb +96 -0
- data/lib/openapi_client/api/tokens_api.rb +91 -0
- data/lib/openapi_client/api/user_devices_api.rb +166 -0
- data/lib/openapi_client/api/users_api.rb +452 -0
- data/lib/openapi_client/api_client.rb +431 -0
- data/lib/openapi_client/api_error.rb +58 -0
- data/lib/openapi_client/configuration.rb +383 -0
- data/lib/openapi_client/models/app_info.rb +853 -0
- data/lib/openapi_client/models/app_response.rb +221 -0
- data/lib/openapi_client/models/auth_methods.rb +254 -0
- data/lib/openapi_client/models/create_magic_link_request.rb +374 -0
- data/lib/openapi_client/models/create_user_request.rb +234 -0
- data/lib/openapi_client/models/element_customization.rb +457 -0
- data/lib/openapi_client/models/font_family.rb +58 -0
- data/lib/openapi_client/models/layout_config.rb +285 -0
- data/lib/openapi_client/models/layouts.rb +241 -0
- data/lib/openapi_client/models/list_devices_response.rb +223 -0
- data/lib/openapi_client/models/magic_link.rb +387 -0
- data/lib/openapi_client/models/magic_link_auth_method.rb +302 -0
- data/lib/openapi_client/models/magic_link_channel.rb +40 -0
- data/lib/openapi_client/models/magic_link_response.rb +221 -0
- data/lib/openapi_client/models/magic_link_type.rb +40 -0
- data/lib/openapi_client/models/model400_error.rb +271 -0
- data/lib/openapi_client/models/model401_error.rb +271 -0
- data/lib/openapi_client/models/model404_error.rb +271 -0
- data/lib/openapi_client/models/model500_error.rb +271 -0
- data/lib/openapi_client/models/otp_auth_method.rb +302 -0
- data/lib/openapi_client/models/passkeys_auth_method.rb +228 -0
- data/lib/openapi_client/models/technologies.rb +46 -0
- data/lib/openapi_client/models/ttl_display_unit.rb +42 -0
- data/lib/openapi_client/models/update_magic_link_auth_method.rb +276 -0
- data/lib/openapi_client/models/update_otp_auth_method.rb +276 -0
- data/lib/openapi_client/models/update_passkeys_auth_method.rb +216 -0
- data/lib/openapi_client/models/update_user_request.rb +232 -0
- data/lib/openapi_client/models/user_event_info.rb +285 -0
- data/lib/openapi_client/models/user_info.rb +470 -0
- data/lib/openapi_client/models/user_metadata_field.rb +323 -0
- data/lib/openapi_client/models/user_metadata_field_type.rb +44 -0
- data/lib/openapi_client/models/user_response.rb +221 -0
- data/lib/openapi_client/models/user_status.rb +41 -0
- data/lib/openapi_client/models/web_authn_devices.rb +378 -0
- data/lib/openapi_client/models/web_authn_icons.rb +230 -0
- data/lib/openapi_client/models/web_authn_type.rb +41 -0
- data/lib/openapi_client/version.rb +15 -0
- data/lib/openapi_client.rb +74 -0
- data/lib/passageidentity/auth.rb +32 -5
- data/lib/passageidentity/client.rb +17 -121
- data/lib/passageidentity/user_api.rb +29 -131
- data/lib/passageidentity/version.rb +5 -0
- data/openapitools.json +7 -0
- data/passageidentity.gemspec +3 -1
- data/tests/auth_test.rb +6 -1
- data/tests/magic_link_test.rb +5 -4
- data/tests/user_api_test.rb +2 -2
- metadata +96 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5fad890a1b4da5a9bda57cf0441dbfb76e7b5275c6e63b97ea001897f146847
|
4
|
+
data.tar.gz: f5008109d3d726a62312ee8ff85b008ecce5fc993b5f89d963cb44d0f7d21775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1beabd989e6a3357f42326c974cf61a118d8cc076be7ba2df4adccbcd0d90877c1052b03d331b3d20d6defc2d74c285ed38664943810358960dcfe02064431e3
|
7
|
+
data.tar.gz: 60811539a0ae157adcb4f4f4fcbab795bbd3041cbee5c80710a4793a95dae1d0485e9b68f58b24f3a02f1e6ccf8bd6a237d673d03305c65f43031fdac7cfc76e
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [0.3.0] - 2023-12-06
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Generate types and api calls with openapi generator.
|
10
|
+
- Version constant instead of parsing gemspec.
|
11
|
+
|
12
|
+
|
13
|
+
### Deprecate
|
14
|
+
|
15
|
+
- `user.signout()` -> `auth.revoke_user_refresh_tokens()`
|
16
|
+
- `auth.authenticate_request()` -> `auth.validate_jwt()`
|
17
|
+
|
18
|
+
|
19
|
+
### Possible Breaking Changes
|
20
|
+
|
21
|
+
- Types are now generated. Previous type names may have changed. [See documentation](https://github.com/passageidentity/passage-ruby/tree/main/docs/generated) for model definitions.
|
data/README.md
CHANGED
@@ -64,23 +64,6 @@ app_info = PassageClient.get_app()
|
|
64
64
|
|
65
65
|
```
|
66
66
|
|
67
|
-
The information available in the Passage App struct returned by PassageClient.get_app():
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
Struct.new :name,
|
71
|
-
:id,
|
72
|
-
:auth_origin,
|
73
|
-
:redirect_url,
|
74
|
-
:login_url,
|
75
|
-
:rsa_public_key,
|
76
|
-
:allowed_identifer,
|
77
|
-
:require_identifier_verification,
|
78
|
-
:session_timeout_length,
|
79
|
-
:user_metadata_schema,
|
80
|
-
:layouts,
|
81
|
-
:auth_fallback_method,
|
82
|
-
:auth_fallback_method_ttl
|
83
|
-
```
|
84
67
|
|
85
68
|
## Retrieve User Info
|
86
69
|
|
@@ -104,24 +87,6 @@ class ApplicationController < ActionController::Base
|
|
104
87
|
end
|
105
88
|
```
|
106
89
|
|
107
|
-
The information available in the Passage User struct returned by PassageClient.user.get(user_id:):
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
Struct.new :id,
|
111
|
-
:status,
|
112
|
-
:email,
|
113
|
-
:phone,
|
114
|
-
:email_verified,
|
115
|
-
:phone_verified,
|
116
|
-
:created_at,
|
117
|
-
:updated_at,
|
118
|
-
:last_login_at,
|
119
|
-
:login_count,
|
120
|
-
:recent_events,
|
121
|
-
:webauthn,
|
122
|
-
:webauthn_devices,
|
123
|
-
:user_metadata,
|
124
|
-
```
|
125
90
|
|
126
91
|
## Activate/Deactivate User
|
127
92
|
|
@@ -179,18 +144,6 @@ PassageClient =
|
|
179
144
|
devices = PassageClient.user.list_devices(user_id: user_id)
|
180
145
|
```
|
181
146
|
|
182
|
-
The information available in the array of Passage Device struct returned by PassageClient.user.list_devices(user_id:):
|
183
|
-
|
184
|
-
```ruby
|
185
|
-
Struct.new :id,
|
186
|
-
:cred_id,
|
187
|
-
:friendly_name,
|
188
|
-
:usage_count,
|
189
|
-
:updated_at,
|
190
|
-
:created_at,
|
191
|
-
:last_login_at,
|
192
|
-
|
193
|
-
```
|
194
147
|
|
195
148
|
## List User Devices
|
196
149
|
|
@@ -227,17 +180,21 @@ magic_link =
|
|
227
180
|
)
|
228
181
|
```
|
229
182
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
183
|
+
## Available Functions
|
184
|
+
|
185
|
+
|
186
|
+
Class | Method | Description
|
187
|
+
------------ | ------------- | -------------
|
188
|
+
*ClientApi* | [**get_app**](docs/custom/ClientApi.md#get_app) | Get App
|
189
|
+
*ClientApi* | [**create_magic_link**](docs/custom/Passage/ClientApi.md#create_magic_link) | Create Embeddable Magic Link
|
190
|
+
*AuthApi* | [**auth.authenticate_request**](docs/custom/AuthApi.md#authenticate_request) | Validates user jwt token
|
191
|
+
*AuthApi* | [**auth.validate_jwt**](docs/custom/AuthApi.md#validate_jwt) | Validates user jwt token
|
192
|
+
*UserAPI* | [**user.delete_device**](docs/custom/UserApi.md#delete_device) | Delete a device for a user
|
193
|
+
*UserAPI* | [**user.list_devices**](docs/custom/UserApi.md#list_devices) | List User Devices
|
194
|
+
*UserAPI* | [**user.activate**](docs/custom/UserApi.md#activate) | Activate User
|
195
|
+
*UserAPI* | [**user.create**](docs/custom/UserApi.md#create) | Create User
|
196
|
+
*UserAPI* | [**user.deactivate**](docs/custom/UserApi.md#deactivate) | Deactivate User
|
197
|
+
*UserAPI* | [**user.delete**](docs/custom/UserApi.md#delete) | Delete User
|
198
|
+
*UserAPI* | [**user.get**](docs/custom/UserApi.md#get) | Get User
|
199
|
+
*UserAPI* | [**user.update**](docs/custom/UserApi.md#update) | Update User
|
200
|
+
*UserAPI* | [**user.signout**](docs/custom/UserApi.md#signout) | Signout User
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# Passage::AuthApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.passage.id/v1*
|
4
|
+
|
5
|
+
| Method | Description |
|
6
|
+
| ------ | ----------- |
|
7
|
+
| [**authenticate_request**](AuthApi.md#authenticate_request) | **Deprecated:** Revokes refresh tokens |
|
8
|
+
| [**revoke_user_refresh_tokens**](AuthApi.md#revoke_user_refresh_tokens) | Revokes user tokens |
|
9
|
+
| [**validate_jwt**](AuthApi.md#validate_jwt) | Validates jwt token
|
10
|
+
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
## authenticate_request (deprecated)
|
15
|
+
|
16
|
+
> authenticate_request(request)
|
17
|
+
|
18
|
+
Validates that request has the correct jwt token
|
19
|
+
|
20
|
+
|
21
|
+
### Examples
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'passageidentity'
|
25
|
+
|
26
|
+
class ApplicationController < ActionController::Base
|
27
|
+
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
|
28
|
+
|
29
|
+
def authorize!
|
30
|
+
begin
|
31
|
+
request.to_hash()
|
32
|
+
@user_id = Passage.auth.authenticate_request(request)
|
33
|
+
session[:psg_user_id] = @user_id
|
34
|
+
rescue Exception => e
|
35
|
+
# unauthorized
|
36
|
+
redirect_to "/unauthorized"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
### Parameters
|
43
|
+
|
44
|
+
| Name | Type | Description | Notes |
|
45
|
+
| ---- | ---- | ----------- | ----- |
|
46
|
+
| **request** | **RequestObject** | request | |
|
47
|
+
|
48
|
+
### Return type
|
49
|
+
|
50
|
+
[**UserInfo**](UserInfo.md)
|
51
|
+
|
52
|
+
### Authorization
|
53
|
+
|
54
|
+
[bearerAuth](../README.md#bearerAuth)
|
55
|
+
|
56
|
+
|
57
|
+
---
|
58
|
+
|
59
|
+
## revoke_user_refresh_tokens()
|
60
|
+
|
61
|
+
> revoke_user_refresh_tokens(user_id)
|
62
|
+
|
63
|
+
Revokes user tokens
|
64
|
+
|
65
|
+
### Examples
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
require 'passageidentity'
|
69
|
+
|
70
|
+
class ApplicationController < ActionController::Base
|
71
|
+
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
|
72
|
+
|
73
|
+
def authorize!
|
74
|
+
begin
|
75
|
+
revoke = PassageClient.auth.revoke_user_refresh_tokens(USER_ID)
|
76
|
+
rescue Exception => e
|
77
|
+
# handle exception (user is not authorized)
|
78
|
+
# unauthorized
|
79
|
+
redirect_to "/unauthorized"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
### Parameters
|
86
|
+
|
87
|
+
| Name | Type | Description | Notes |
|
88
|
+
| ---- | ---- | ----------- | ----- |
|
89
|
+
| **user_id** | **string** | user id | |
|
90
|
+
|
91
|
+
### Return type
|
92
|
+
|
93
|
+
boolean
|
94
|
+
|
95
|
+
### Authorization
|
96
|
+
|
97
|
+
[bearerAuth](../README.md#bearerAuth)
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
---
|
102
|
+
|
103
|
+
## validate_jwt
|
104
|
+
|
105
|
+
> validate_jwt(token)
|
106
|
+
|
107
|
+
Validates jwt token for a user
|
108
|
+
|
109
|
+
### Examples
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
require 'passageidentity'
|
113
|
+
|
114
|
+
class ApplicationController < ActionController::Base
|
115
|
+
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
|
116
|
+
|
117
|
+
def validate_passage_user!
|
118
|
+
begin
|
119
|
+
# tokens are revoked
|
120
|
+
revoke = PassageClient.auth.validate_jwt(token)
|
121
|
+
rescue Exception => e
|
122
|
+
# handle exception (user is not authorized)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
128
|
+
### Parameters
|
129
|
+
|
130
|
+
| Name | Type | Description | Notes |
|
131
|
+
| ---- | ---- | ----------- | ----- |
|
132
|
+
| **token** | **String** | jwt token | |
|
133
|
+
|
134
|
+
### Return type
|
135
|
+
|
136
|
+
[**UserInfo**](UserInfo.md)
|
137
|
+
|
138
|
+
### Authorization
|
139
|
+
|
140
|
+
[bearerAuth](../README.md#bearerAuth)
|
141
|
+
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Passage::ClientApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.passage.id/v1*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**get_app**](ClientApi.md#get_app) | **GET** /apps/{app_id} | Get App |
|
8
|
+
| [**create_magic_link**](ClientApi.md#create_magic_link) | **POST** /apps/{app_id}/magic-links | Create Embeddable Magic Link |
|
9
|
+
|
10
|
+
|
11
|
+
## get_app
|
12
|
+
|
13
|
+
> <AppResponse> get_app()
|
14
|
+
|
15
|
+
Get App
|
16
|
+
|
17
|
+
Get app information.
|
18
|
+
|
19
|
+
### Examples
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
|
23
|
+
|
24
|
+
begin
|
25
|
+
# Get App
|
26
|
+
result = PassageClient.get_app()
|
27
|
+
p result
|
28
|
+
rescue OpenapiClient::ApiError => e
|
29
|
+
puts "Error when calling AppsApi->get_app: #{e}"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
### Parameters
|
35
|
+
|
36
|
+
| Name | Type | Description | Notes |
|
37
|
+
| ---- | ---- | ----------- | ----- |
|
38
|
+
| **app_id** | **String** | App ID | |
|
39
|
+
|
40
|
+
### Return type
|
41
|
+
|
42
|
+
[**AppResponse**](AppResponse.md)
|
43
|
+
|
44
|
+
### Authorization
|
45
|
+
|
46
|
+
[bearerAuth](../README.md#bearerAuth)
|
47
|
+
|
48
|
+
### HTTP request headers
|
49
|
+
|
50
|
+
- **Content-Type**: Not defined
|
51
|
+
- **Accept**: application/json
|
52
|
+
|
53
|
+
---
|
54
|
+
|
55
|
+
|
56
|
+
## create_magic_link
|
57
|
+
|
58
|
+
> <MagicLinkResponse> create_magic_link(create_magic_link_request)
|
59
|
+
|
60
|
+
Create Embeddable Magic Link
|
61
|
+
|
62
|
+
Create magic link for a user.
|
63
|
+
|
64
|
+
### Examples
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
|
68
|
+
|
69
|
+
api_instance = PassageClient.create_magic_link()
|
70
|
+
|
71
|
+
create_magic_link_request = OpenapiClient::create_magic_link({channel: OpenapiClient::MagicLinkChannel::EMAIL, email: 'email_example', magic_link_path: 'magic_link_path_example', phone: 'phone_example', redirect_url: 'redirect_url_example', _send: false, ttl: 37, user_id: 'user_id_example'}) # CreateMagicLinkRequest | magic link request
|
72
|
+
|
73
|
+
begin
|
74
|
+
# Create Embeddable Magic Link
|
75
|
+
result = PassageClient.create_magic_link.create_magic_link(create_magic_link_request)
|
76
|
+
p result
|
77
|
+
rescue OpenapiClient::ApiError => e
|
78
|
+
puts "Error when calling MagicLinksApi->create_magic_link: #{e}"
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
#### Using the create_magic_link_with_http_info variant
|
83
|
+
|
84
|
+
This returns an Array which contains the response data, status code and headers.
|
85
|
+
|
86
|
+
> <Array(<MagicLinkResponse>, Integer, Hash)> create_magic_link_with_http_info(app_id, create_magic_link_request)
|
87
|
+
|
88
|
+
|
89
|
+
### Parameters
|
90
|
+
|
91
|
+
| Name | Type | Description | Notes |
|
92
|
+
| ---- | ---- | ----------- | ----- |
|
93
|
+
| **create_magic_link_request** | [**CreateMagicLinkRequest**](CreateMagicLinkRequest.md) | magic link request | |
|
94
|
+
|
95
|
+
### Return type
|
96
|
+
|
97
|
+
[**MagicLinkResponse**](MagicLinkResponse.md)
|
98
|
+
|
99
|
+
### Authorization
|
100
|
+
|
101
|
+
[bearerAuth](../README.md#bearerAuth)
|
102
|
+
|
103
|
+
### HTTP request headers
|
104
|
+
|
105
|
+
- **Content-Type**: application/json
|
106
|
+
- **Accept**: application/json
|
107
|
+
|