authress-sdk 0.1.18.0 → 0.1.19.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.
Files changed (2) hide show
  1. checksums.yaml +4 -4
  2. metadata +104 -99
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 780c05e767e2999aed766676c564ac7003c6e0255895ff3fdf5dd69f8eebe1da
4
- data.tar.gz: 9573215968e0a8b2f53f7b43cc7557cdfa5a1cc0592acb43e9ca222224b45f33
3
+ metadata.gz: 7181eae557d3464a2626ffa2f35cab55a291392c7e51cb56aeb094f15127b3f2
4
+ data.tar.gz: ce4d5eab18ff90687aa34c302408c5de5dad85e97bec8e71f44d8b73c7fb57b9
5
5
  SHA512:
6
- metadata.gz: 86b42ff1df2d460f38f14d374d7e67ef36e323c65c44c88ecc0d9553b1c0b5fc6bb60baf2ad36e75a90263621f105eff79651a3c46df76ef8ebc654dcc4888a5
7
- data.tar.gz: c91ba75c6f49a5c85475fa69e197febd0ae4568c966529fdccbd3e214f4170cc896fd0dfcd4a6665dfb3e7327752d3dbf9e2db1c729b32d123778d81a14d17e5
6
+ metadata.gz: 9de5a2e1dc97a754abfd180f517b8d17d7151ce84d8a87f009ba1e0c6291ddba53a9fc6b505576a386f48c2c9e6deee22df9e88d9fab4b3ba5f2d49162be5c1a
7
+ data.tar.gz: 6551410fd9d0c61e2049bb00a0f48fd960acadecdabd5a4a7434d28afbfa8f6e94a62f4d754f742d66cc7c8c1f20d374e5bbae15c2bc63e91b7ccfb5b488f384
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authress-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18.0
4
+ version: 0.1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rhosys
@@ -71,129 +71,133 @@ dependencies:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: 3.6.0
74
- description: |-
75
- # authress-sdk.rb
76
- This is the Authress SDK used to integrate with the authorization as a service provider Authress at https://authress.io.
77
-
78
- [![Gem Version](https://badge.fury.io/rb/authress-sdk.svg)](http://badge.fury.io/rb/authress-sdk)
74
+ description: |+
75
+ # authress-sdk.rb This is the Authress SDK used to integrate with the
76
+ authorization as a service provider Authress at https://authress.io.
79
77
 
78
+ [![Gem
79
+ Version](https://badge.fury.io/rb/authress-sdk.svg)](http://badge.fury.io/rb/a
80
+ uthress-sdk)
80
81
 
81
82
  ## Usage
82
83
 
83
- ```sh
84
- gem install authress-sdk
85
- ```
84
+ ```sh gem install authress-sdk ```
86
85
 
87
- Then required the package:
88
- ```rb
89
- require 'authress-sdk';
90
- ```
86
+ Then required the package: ```rb require 'authress-sdk'; ```
91
87
 
92
88
  ## Getting started examples
93
89
 
94
- ### Authorize using a user token
95
- ```rb
96
- require 'authress-sdk';
90
+ ### Authorize using a user token ```rb require 'authress-sdk';
97
91
 
98
- # create an instance of the API class during service initialization
99
- # Replace DOMAIN with the Authress domain for your account
100
- AuthressClient.configure do |config|
92
+ # create an instance of the API class during service initialization # Replace
93
+ DOMAIN with the Authress domain for your account AuthressClient.configure do
94
+ |config|
101
95
  config.base_url = 'https://DOMAIN.api-REGION.authress.io'
96
+
102
97
  end
103
98
 
104
99
  # on api route
105
- [route('/resources/<resourceId>')]
106
- function getResource(resourceId) {
107
- # Get the user token and pass it to authress
108
- authorizationToken = request.headers.get('authorization');
109
- AuthressClient.setToken(authorizationToken);
100
+ route('/resources/<resourceId>'):
101
+ function getResource(resourceId) {
102
+ # Get the user token and pass it to authress
103
+ authorizationToken = request.headers.get('authorization');
104
+ AuthressClient.setToken(authorizationToken);
110
105
 
111
- # Check Authress to authorize the user
112
- user_id = 'user_id_example' # String | The user to check permissions on
113
- resource_uri = `resources/${resourceId}` # String | The uri path of a resource to validate, must be URL encoded, uri segments are allowed, the resource must be a full path, and permissions are not inherited by sub-resources.
114
- permission = 'READ' # String | Permission to check, '*' and scoped permissions can also be checked here.
115
- begin
116
- #Check to see if a user has permissions to a resource.
117
- api_instance = SwaggerClient::UserPermissionsApi.new
118
- api_instance.authorize_user(user_id, resource_uri, permission)
119
- rescue SwaggerClient::ApiError => e
120
- # Will throw except if the user is not authorized to read the resource
121
- if (e.status === 404) {
122
- return { statusCode: 404 };
123
- }
124
- puts "Exception when calling UserPermissionsApi->authorize_user: #{e}"
125
- throw e;
126
- end
106
+ # Check Authress to authorize the user
107
+ user_id = 'user_id_example' # String | The user to check permissions on
108
+ resource_uri = `resources/${resourceId}` # String | The uri path of a resource to validate, must be URL encoded, uri segments are allowed, the resource must be a full path, and permissions are not inherited by sub-resources.
109
+ permission = 'READ' # String | Permission to check, '*' and scoped permissions can also be checked here.
110
+ begin
111
+ #Check to see if a user has permissions to a resource.
112
+ api_instance = SwaggerClient::UserPermissionsApi.new
113
+ api_instance.authorize_user(user_id, resource_uri, permission)
114
+ rescue SwaggerClient::ApiError => e
115
+ # Will throw except if the user is not authorized to read the resource
116
+ if (e.status === 404) {
117
+ return { statusCode: 404 };
118
+ }
119
+ puts "Exception when calling UserPermissionsApi->authorize_user: #{e}"
120
+ throw e;
121
+ end
127
122
 
128
- # On success, continue with the route code to load resource and return it
129
- return { resource: {}, statusCode: 200 };
130
- ```
123
+ # On success, continue with the route code to load resource and return it
124
+ return { resource: {}, statusCode: 200 };
131
125
 
132
- ### Authorize with a service client
133
- ```rb
134
- require 'authress-sdk';
126
+ ```
135
127
 
136
- # create an instance of the API class during service initialization
137
- # Replace DOMAIN with the Authress domain for your account
128
+ ### Authorize with a service client ```rb require 'authress-sdk';
138
129
 
139
- # Create a service client in the Authress management portal and past the access token here
140
- # This will generate a token automatically instead of passing the user token to the api
141
- AuthressClient.configure do |config|
142
- config.base_url = 'https://DOMAIN.api-REGION.authress.io'
143
- accessToken = 'eyJrZXlJ....';
144
- config.token_provider = ServiceClientTokenProvider.new(accessToken)
145
- end
130
+ # create an instance of the API class during service initialization #
131
+ Replace DOMAIN with the Authress domain for your account
132
+
133
+ # Create a service client in the Authress management portal and past the
134
+ access token here # This will generate a token automatically instead of
135
+ passing the user token to the api AuthressClient.configure do |config|
136
+ config.base_url = 'https://DOMAIN.api-REGION.authress.io'
137
+ accessToken = 'eyJrZXlJ....';
138
+ config.token_provider = ServiceClientTokenProvider.new(accessToken)
146
139
 
147
- # on api route
148
- [route('/resources/<resourceId>')]
149
- function getResource(resourceId) {
150
- # Check Authress to authorize the user
151
- user_id = 'user_id_example' # String | The user to check permissions on
152
- resource_uri = `resources/${resourceId}` # String | The uri path of a resource to validate, must be URL encoded, uri segments are allowed, the resource must be a full path, and permissions are not inherited by sub-resources.
153
- permission = 'READ' # String | Permission to check, '*' and scoped permissions can also be checked here.
154
- begin
155
- #Check to see if a user has permissions to a resource.
156
- api_instance = SwaggerClient::UserPermissionsApi.new
157
- api_instance.authorize_user(user_id, resource_uri, permission)
158
- rescue SwaggerClient::ApiError => e
159
- # Will throw except if the user is not authorized to read the resource
160
- if (e.status === 404) {
161
- return { statusCode: 404 };
162
- }
163
- puts "Exception when calling UserPermissionsApi->authorize_user: #{e}"
164
- throw e;
165
140
  end
166
141
 
167
- # On success, continue with the route code to load resource and return it
168
- return { resource: {}, statusCode: 200 };
169
- ```
142
+ # on api route
143
+ route('/resources/<resourceId>'):
144
+ function getResource(resourceId) {
145
+ # Check Authress to authorize the user
146
+ user_id = 'user_id_example' # String | The user to check permissions on
147
+ resource_uri = `resources/${resourceId}` # String | The uri path of a resource to validate, must be URL encoded, uri segments are allowed, the resource must be a full path, and permissions are not inherited by sub-resources.
148
+ permission = 'READ' # String | Permission to check, '*' and scoped permissions can also be checked here.
149
+ begin
150
+ #Check to see if a user has permissions to a resource.
151
+ api_instance = SwaggerClient::UserPermissionsApi.new
152
+ api_instance.authorize_user(user_id, resource_uri, permission)
153
+ rescue SwaggerClient::ApiError => e
154
+ # Will throw except if the user is not authorized to read the resource
155
+ if (e.status === 404) {
156
+ return { statusCode: 404 };
157
+ }
158
+ puts "Exception when calling UserPermissionsApi->authorize_user: #{e}"
159
+ throw e;
160
+ end
170
161
 
171
- ### Creating resources
172
- When a user creates a resource in your application, we want to ensure that they get access own that resource.
162
+ # On success, continue with the route code to load resource and return it
163
+ return { resource: {}, statusCode: 200 };
173
164
 
174
- You may receive **User does not have sufficient access to grant permissions to resources** as an error along with the status code **403**. This means that the service client or user jwt does not have access to create the access record. If using a service client, go to the Authress portal and create a one time record which grants the service client `Authress:Owner` to `Resources/` so that it can manage access records for these types of resources.
165
+ ```
166
+
167
+ ### Creating resources When a user creates a resource in your application,
168
+ we want to ensure that they get access own that resource.
169
+
170
+ You may receive **User does not have sufficient access to grant
171
+ permissions to resources** as an error along with the status code
172
+ *<b>403</b>*. This means that the service client or user jwt does not have
173
+ access to create the access record. If using a service client, go to the
174
+ Authress portal and create a one time record which grants the service
175
+ client `Authress:Owner` to `Resources/` so that it can manage access
176
+ records for these types of resources.
177
+
178
+ ```rb require 'authress-sdk';
179
+
180
+ begin
181
+ #Create a new access record.
182
+ new_record = SwaggerClient::Body3.new {
183
+ name: `Access To New Resource ${NewResourceId}`,
184
+ users: [{ userId: requestUserId }],
185
+ statements: [{
186
+ resources: [{ resourceUri: `Resources/${NewResourceId}` }],
187
+ # Owner by default gives full control over this new resource, including the ability to grant others access as well.
188
+ roles: ['Authress:Owner']
189
+ }]
190
+ };
191
+ api_instance = SwaggerClient::AccessRecordsApi.new
192
+ result = api_instance.create_record(new_record)
193
+ puts result
194
+
195
+ rescue SwaggerClient::ApiError => e
196
+ puts "Exception when calling AccessRecordsApi->create_record: #{e}"
197
+
198
+ end ```
175
199
 
176
- ```rb
177
- require 'authress-sdk';
178
200
 
179
- begin
180
- #Create a new access record.
181
- new_record = SwaggerClient::Body3.new {
182
- name: `Access To New Resource ${NewResourceId}`,
183
- users: [{ userId: requestUserId }],
184
- statements: [{
185
- resources: [{ resourceUri: `Resources/${NewResourceId}` }],
186
- # Owner by default gives full control over this new resource, including the ability to grant others access as well.
187
- roles: ['Authress:Owner']
188
- }]
189
- };
190
- api_instance = SwaggerClient::AccessRecordsApi.new
191
- result = api_instance.create_record(new_record)
192
- puts result
193
- rescue SwaggerClient::ApiError => e
194
- puts "Exception when calling AccessRecordsApi->create_record: #{e}"
195
- end
196
- ```
197
201
  email:
198
202
  - support@authress.io
199
203
  executables: []
@@ -311,3 +315,4 @@ specification_version: 4
311
315
  summary: The Authress SDK for Ruby provides authorization as a service with fully
312
316
  compatible REST apis to integrate with Authress at https://authress.io.
313
317
  test_files: []
318
+ ...