17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/azure/directory.rb', line 17
def initialize(scope = :main)
@config = Azure::Directory.configuration
@config = @config.using(scope) if @config.scope_name != scope
@oauth = OAuth2::Client.new( @config.client_id, @config.client_secret,
:site => 'https://login.windows.net/',
:authorize_url => "/#{@config.tenant_id}/oauth2/authorize",
:token_url => "/#{@config.tenant_id}/oauth2/token" )
if token_hash = @config.load_token
@oauth_token = OAuth2::AccessToken.from_hash(@oauth, token_hash)
else
fetch_access_token!
end
end
|