Module: Conjur::API::Router::V4
Instance Method Summary
collapse
-
#authn_authenticate(account, username) ⇒ Object
-
#authn_authenticate_local(username, account, expiration, cidr, &block) ⇒ Object
For v4, the authn-local message is the username.
-
#authn_login(account, username, password) ⇒ Object
-
#authn_rotate_api_key(credentials, account, id) ⇒ Object
-
#authn_rotate_own_api_key(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
-
#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
-
#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(credentials, id) ⇒ Object
-
#variable_attributes(credentials, resource, id) ⇒ Object
fully_escape, path_escape, path_or_query_escape, query_escape
Instance Method Details
#authn_authenticate(account, username) ⇒ Object
#authn_authenticate_local(username, account, expiration, cidr, &block) ⇒ Object
For v4, the authn-local message is the username.
29
30
31
32
33
34
35
36
|
# File 'lib/conjur/api/router/v4.rb', line 29
def authn_authenticate_local username, account, expiration, cidr, &block
verify_account(account)
raise "'expiration' is not supported for authn-local v4" if expiration
raise "'cidr' is not supported for authn-local v4" if cidr
username
end
|
#authn_login(account, username, password) ⇒ Object
#authn_rotate_api_key(credentials, account, id) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/conjur/api/router/v4.rb', line 38
def authn_rotate_api_key credentials, account, id
verify_account(account)
username = id.kind == "user" ? id.identifier : [id.kind, id.identifier].join('/')
RestClient::Resource.new(
Conjur.configuration.authn_url,
Conjur.configuration.create_rest_client_options(credentials)
)['users']["api_key?id=#{username}"]
end
|
#authn_rotate_own_api_key(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
#parse_group_gidnumber(attributes) ⇒ Object
176
177
178
|
# File 'lib/conjur/api/router/v4.rb', line 176
def parse_group_gidnumber attributes
attributes['gidnumber']
end
|
#parse_members(credentials, result) ⇒ Object
192
193
194
195
196
|
# File 'lib/conjur/api/router/v4.rb', line 192
def parse_members credentials, result
result.collect do |json|
RoleGrant.parse_from_json(json, credentials)
end
end
|
#parse_user_uidnumber(attributes) ⇒ Object
180
181
182
|
# File 'lib/conjur/api/router/v4.rb', line 180
def parse_user_uidnumber attributes
attributes['uidnumber']
end
|
#parse_variable_kind(attributes) ⇒ Object
184
185
186
|
# File 'lib/conjur/api/router/v4.rb', line 184
def parse_variable_kind attributes
attributes['kind']
end
|
#parse_variable_mime_type(attributes) ⇒ Object
188
189
190
|
# File 'lib/conjur/api/router/v4.rb', line 188
def parse_variable_mime_type attributes
attributes['mime_type']
end
|
#resources_check(credentials, id, privilege, role) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/conjur/api/router/v4.rb', line 87
def resources_check credentials, id, privilege, role
options = {}
options[:check] = true
options[:privilege] = privilege
if role
options[:resource_id] = id
roles_role(credentials, Id.new(role))[options_querystring options].get
else
resources_resource(credentials, id)[options_querystring options].get
end
end
|
#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
136
137
138
139
140
141
142
143
144
|
# File 'lib/conjur/api/router/v4.rb', line 136
def secrets_values credentials, variable_ids
options = {
vars: Array(variable_ids).map { |v| fully_escape(v.identifier) }.join(',')
}
RestClient::Resource.new(
Conjur.configuration.core_url,
Conjur.configuration.create_rest_client_options(credentials)
)['variables']['values'][options_querystring options]
end
|
#user_attributes(credentials, resource, id) ⇒ Object
#variable(credentials, id) ⇒ Object
#variable_attributes(credentials, resource, id) ⇒ Object