Module: Conjur::API::Router::V5
Overview
V5 translates method arguments to rest-ful API request parameters.
because of this, most of the methods suffer from :reek:LongParameterList:
and :reek:UtilityFunction:
Instance Method Summary
collapse
-
#authentication_providers(account, authenticator, credentials) ⇒ Object
-
#authenticator(account, authenticator, service_id, credentials) ⇒ Object
-
#authenticator_authenticate(account, service_id, authenticator, options) ⇒ Object
-
#authenticators ⇒ Object
-
#authn_authenticate(account, username) ⇒ Object
-
#authn_authenticate_local(username, account, expiration, cidr, &block) ⇒ Object
For v5, the authn-local message is a JSON string with account, sub, and optional fields.
-
#authn_login(account, username, password) ⇒ Object
-
#authn_rotate_api_key(credentials, account, id) ⇒ Object
-
#authn_rotate_own_api_key(account, username, password) ⇒ Object
-
#authn_update_password(account, username, password) ⇒ Object
-
#group_attributes(credentials, resource, id) ⇒ Object
-
#host_factory_create_host(token) ⇒ Object
-
#host_factory_create_tokens(credentials, id) ⇒ Object
-
#host_factory_revoke_token(credentials, token) ⇒ Object
-
#ldap_sync_policy(credentials, config_name) ⇒ Object
-
#parse_group_gidnumber(attributes) ⇒ Object
-
#parse_members(credentials, result) ⇒ Object
-
#parse_user_uidnumber(attributes) ⇒ Object
-
#parse_variable_kind(attributes) ⇒ Object
-
#parse_variable_mime_type(attributes) ⇒ Object
-
#policies_load_policy(credentials, account, id) ⇒ Object
-
#public_keys_for_user(account, username) ⇒ Object
-
#resources(credentials, account, kind, options) ⇒ Object
-
#resources_check(credentials, id, privilege, role) ⇒ Object
-
#resources_permitted_roles(credentials, id, privilege) ⇒ Object
-
#resources_resource(credentials, id) ⇒ Object
-
#roles_role(credentials, id) ⇒ Object
-
#secrets_add(credentials, id) ⇒ Object
-
#secrets_value(credentials, id, options) ⇒ Object
-
#secrets_values(credentials, variable_ids) ⇒ Object
-
#user_attributes(credentials, resource, id) ⇒ Object
-
#variable_attributes(credentials, resource, id) ⇒ Object
-
#whoami(credentials) ⇒ Object
fully_escape, path_escape, path_or_query_escape, query_escape
Instance Method Details
#authentication_providers(account, authenticator, credentials) ⇒ Object
#authenticator(account, authenticator, service_id, credentials) ⇒ Object
#authenticator_authenticate(account, service_id, authenticator, options) ⇒ Object
46
47
48
49
50
51
|
# File 'lib/conjur/api/router/v5.rb', line 46
def authenticator_authenticate(account, service_id, authenticator, options)
RestClient::Resource.new(
Conjur.configuration.core_url,
Conjur.configuration.rest_client_options
)[fully_escape authenticator][fully_escape service_id][fully_escape account]['authenticate'][options_querystring options]
end
|
#authn_authenticate(account, username) ⇒ Object
#authn_authenticate_local(username, account, expiration, cidr, &block) ⇒ Object
For v5, the authn-local message is a JSON string with account, sub, and optional fields.
75
76
77
78
79
80
|
# File 'lib/conjur/api/router/v5.rb', line 75
def authn_authenticate_local username, account, expiration, cidr, &block
{ account: account, sub: username }.tap do |params|
params[:exp] = expiration if expiration
params[:cidr] = cidr if cidr
end.to_json
end
|
#authn_login(account, username, password) ⇒ Object
#authn_rotate_api_key(credentials, account, id) ⇒ Object
#authn_rotate_own_api_key(account, username, password) ⇒ Object
#authn_update_password(account, username, password) ⇒ Object
#group_attributes(credentials, resource, id) ⇒ Object
212
213
214
|
# File 'lib/conjur/api/router/v5.rb', line 212
def group_attributes credentials, resource, id
resource_annotations resource
end
|
#host_factory_create_host(token) ⇒ Object
#host_factory_create_tokens(credentials, id) ⇒ Object
#host_factory_revoke_token(credentials, token) ⇒ Object
#ldap_sync_policy(credentials, config_name) ⇒ Object
#parse_group_gidnumber(attributes) ⇒ Object
224
225
226
|
# File 'lib/conjur/api/router/v5.rb', line 224
def parse_group_gidnumber attributes
HasAttributes.annotation_value attributes, 'conjur/gidnumber'
end
|
#parse_members(credentials, result) ⇒ Object
240
241
242
243
244
|
# File 'lib/conjur/api/router/v5.rb', line 240
def parse_members credentials, result
result.map do |json|
RoleGrant.parse_from_json(json, credentials)
end
end
|
#parse_user_uidnumber(attributes) ⇒ Object
228
229
230
|
# File 'lib/conjur/api/router/v5.rb', line 228
def parse_user_uidnumber attributes
HasAttributes.annotation_value attributes, 'conjur/uidnumber'
end
|
#parse_variable_kind(attributes) ⇒ Object
232
233
234
|
# File 'lib/conjur/api/router/v5.rb', line 232
def parse_variable_kind attributes
HasAttributes.annotation_value attributes, 'conjur/kind'
end
|
#parse_variable_mime_type(attributes) ⇒ Object
236
237
238
|
# File 'lib/conjur/api/router/v5.rb', line 236
def parse_variable_mime_type attributes
HasAttributes.annotation_value attributes, 'conjur/mime_type'
end
|
#policies_load_policy(credentials, account, id) ⇒ Object
#public_keys_for_user(account, username) ⇒ Object
#resources(credentials, account, kind, options) ⇒ Object
147
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/conjur/api/router/v5.rb', line 147
def resources credentials, account, kind, options
credentials ||= {}
path = "/resources/#{fully_escape account}"
path += "/#{fully_escape kind}" if kind
RestClient::Resource.new(
Conjur.configuration.core_url,
Conjur.configuration.create_rest_client_options(credentials)
)[path][options_querystring options]
end
|
#resources_check(credentials, id, privilege, role) ⇒ Object
173
174
175
176
177
178
179
|
# File 'lib/conjur/api/router/v5.rb', line 173
def resources_check credentials, id, privilege, role
options = {}
options[:check] = true
options[:privilege] = privilege
options[:role] = query_escape(Id.new(role)) if role
resources_resource(credentials, id)[options_querystring options].get
end
|
#resources_permitted_roles(credentials, id, privilege) ⇒ Object
166
167
168
169
170
171
|
# File 'lib/conjur/api/router/v5.rb', line 166
def resources_permitted_roles credentials, id, privilege
options = {}
options[:permitted_roles] = true
options[:privilege] = privilege
resources_resource(credentials, id)[options_querystring options]
end
|
#resources_resource(credentials, id) ⇒ Object
#roles_role(credentials, id) ⇒ Object
#secrets_add(credentials, id) ⇒ Object
#secrets_value(credentials, id, options) ⇒ Object
#secrets_values(credentials, variable_ids) ⇒ Object
202
203
204
205
206
207
208
209
210
|
# File 'lib/conjur/api/router/v5.rb', line 202
def secrets_values credentials, variable_ids
options = {
variable_ids: Array(variable_ids).join(',')
}
RestClient::Resource.new(
Conjur.configuration.core_url,
Conjur.configuration.create_rest_client_options(credentials)
)['secrets'][options_querystring(options).gsub("%2C", ',')]
end
|
#user_attributes(credentials, resource, id) ⇒ Object
220
221
222
|
# File 'lib/conjur/api/router/v5.rb', line 220
def user_attributes credentials, resource, id
resource_annotations resource
end
|
#variable_attributes(credentials, resource, id) ⇒ Object
216
217
218
|
# File 'lib/conjur/api/router/v5.rb', line 216
def variable_attributes credentials, resource, id
resource_annotations resource
end
|
#whoami(credentials) ⇒ Object