Class: Mdm::Enrollment::Auth
Class Method Summary
collapse
Instance Method Summary
collapse
accepted_params, #authenticate?, available_services, #method, #params=, #path, #result, #start
Class Method Details
.token ⇒ Object
20
21
22
|
# File 'lib/mdm/enrollment/service/auth.rb', line 20
def token
@@token ||= new.obtain_token
end
|
.update_token_from_response(response) ⇒ Object
24
25
26
27
28
|
# File 'lib/mdm/enrollment/service/auth.rb', line 24
def update_token_from_response(response)
if response && token = response.['x-adm-auth-session']
@@token = token
end
end
|
Instance Method Details
#obtain_token ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/mdm/enrollment/service/auth.rb', line 32
def obtain_token
client.get '/session',
headers: {
'Authorization' =>
}
client.response['auth_session_token']
end
|
#params ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/mdm/enrollment/service/auth.rb', line 40
def params
@params ||= {
oauth_consumer_key: consumer_key,
oauth_token: access_token,
oauth_nonce: nonce,
oauth_timestamp: Time.now.getutc.to_i.to_s,
oauth_version: '1.0',
oauth_signature_method: 'HMAC-SHA1'
}
end
|