authress-sdk 2.0.43.0 → 2.0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/authress-sdk/models/invite_statement.rb +222 -0
- data/lib/authress-sdk/service_client_token_provider.rb +11 -6
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1166957062f14969294b7ca0e0c4811ab58d9bc8717eda9936fcb63c6f9718e
|
4
|
+
data.tar.gz: 7134539edf6e3adc2a173d9ce10856b5e1c1d672f561bf4b8df6f3a49fa3f437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06ca29fa2d5e89a4f09f20bbe0e0c094eabdefa435f304e9cd6c54e006b3c302a7d8d15012f6fb9c0d1b192407f55a5e75de6c03e5e1600692fed3f5fce9e31
|
7
|
+
data.tar.gz: 1b893088ab688ec37d220eb8a8553b126ddb61d33907290aeb61cad7cdc0dce0a09c4c72bddd6fe31d46c064b5d2ce5dbdf0c0157a755229f3219e551004979c
|
@@ -0,0 +1,222 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
=end
|
4
|
+
|
5
|
+
require 'date'
|
6
|
+
|
7
|
+
module AuthressSdk
|
8
|
+
class InviteStatement
|
9
|
+
attr_accessor :roles
|
10
|
+
|
11
|
+
attr_accessor :resources
|
12
|
+
|
13
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
14
|
+
def self.attribute_map
|
15
|
+
{
|
16
|
+
:'roles' => :'roles',
|
17
|
+
:'resources' => :'resources'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# Attribute type mapping.
|
22
|
+
def self.openapi_types
|
23
|
+
{
|
24
|
+
:'roles' => :'Object',
|
25
|
+
:'resources' => :'Object'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# List of attributes with nullable: true
|
30
|
+
def self.openapi_nullable
|
31
|
+
Set.new([
|
32
|
+
])
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
if (!attributes.is_a?(Hash))
|
39
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::InviteStatement` initialize method"
|
40
|
+
end
|
41
|
+
|
42
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
43
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
44
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
45
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::InviteStatement`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
46
|
+
end
|
47
|
+
h[k.to_sym] = v
|
48
|
+
}
|
49
|
+
|
50
|
+
if attributes.key?(:'roles')
|
51
|
+
if (value = attributes[:'roles']).is_a?(Array)
|
52
|
+
self.roles = value
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if attributes.key?(:'resources')
|
57
|
+
if (value = attributes[:'resources']).is_a?(Array)
|
58
|
+
self.resources = value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
+
# @return Array for valid properties with the reasons
|
65
|
+
def list_invalid_properties
|
66
|
+
invalid_properties = Array.new
|
67
|
+
if @roles.nil?
|
68
|
+
invalid_properties.push('invalid value for "roles", roles cannot be nil.')
|
69
|
+
end
|
70
|
+
|
71
|
+
if @resources.nil?
|
72
|
+
invalid_properties.push('invalid value for "resources", resources cannot be nil.')
|
73
|
+
end
|
74
|
+
|
75
|
+
invalid_properties
|
76
|
+
end
|
77
|
+
|
78
|
+
# Check to see if the all the properties in the model are valid
|
79
|
+
# @return true if the model is valid
|
80
|
+
def valid?
|
81
|
+
return false if @roles.nil?
|
82
|
+
return false if @resources.nil?
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
roles == o.roles &&
|
92
|
+
resources == o.resources
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[roles, resources].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
new.build_from_hash(attributes)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
120
|
+
if type =~ /\AArray<(.*)>/i
|
121
|
+
# check to ensure the input is an array given that the attribute
|
122
|
+
# is documented as an array but the input is not
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
128
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
129
|
+
self.send("#{key}=", nil)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :DateTime
|
143
|
+
DateTime.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :Boolean
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
AuthressSdk.const_get(type).build_from_hash(value)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the string representation of the object
|
178
|
+
# @return [String] String presentation of the object
|
179
|
+
def to_s
|
180
|
+
to_hash.to_s
|
181
|
+
end
|
182
|
+
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_body
|
186
|
+
to_hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = self.send(attr)
|
195
|
+
if value.nil?
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
198
|
+
end
|
199
|
+
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end end
|
222
|
+
end
|
@@ -62,14 +62,19 @@ module AuthressSdk
|
|
62
62
|
raise Exception("Invalid Service Client Access Key")
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
priv_pem = <<~EOF
|
66
|
+
-----BEGIN PRIVATE KEY-----
|
67
|
+
#{decodedAccessKey.privateKey}
|
68
|
+
-----END PRIVATE KEY-----
|
69
|
+
EOF
|
66
70
|
|
67
|
-
|
68
|
-
|
71
|
+
privateKey = OpenSSL::PKey.read(priv_pem)
|
72
|
+
result = Base64.encode64(privateKey.raw_private_key).tr('+/', '-_').delete('=')
|
73
|
+
private_key = RbNaCl::Signatures::Ed25519::SigningKey.new(Base64.decode64(result))
|
69
74
|
|
70
|
-
|
71
|
-
|
72
|
-
|
75
|
+
token = JWT.encode(jwt, private_key, 'ED25519', { typ: 'at+jwt', alg: 'EdDSA', kid: decodedAccessKey.keyId })
|
76
|
+
@cachedKeyData = { token: token, expires: jwt['exp'] }
|
77
|
+
return token
|
73
78
|
end
|
74
79
|
end
|
75
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authress-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.47.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Authress
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -100,6 +100,20 @@ dependencies:
|
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: openssl
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
118
|
name: rspec
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +168,7 @@ files:
|
|
154
168
|
- lib/authress-sdk/models/identity_collection_identities.rb
|
155
169
|
- lib/authress-sdk/models/identity_request.rb
|
156
170
|
- lib/authress-sdk/models/invite.rb
|
171
|
+
- lib/authress-sdk/models/invite_statement.rb
|
157
172
|
- lib/authress-sdk/models/link.rb
|
158
173
|
- lib/authress-sdk/models/metadata_object.rb
|
159
174
|
- lib/authress-sdk/models/permission_collection.rb
|