ms_rest_azure 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +3 -3
- data/lib/ms_rest_azure/credentials/msi_token_provider.rb +3 -10
- data/lib/ms_rest_azure/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d14c95c8933931dff67eef6da2b22a6bbee03a8
|
4
|
+
data.tar.gz: 00d3d6bfce74a3eb61d9991fb06f14b600e90bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe833a3a8333eb293af8a78b20ac9685f21bc03c17677b8ee39de1048220f02f81f39de8ee25b3111f6027a96c953d370a497fc6dab0dfad4c936e6a5c5a787f
|
7
|
+
data.tar.gz: 3a3c1d17168f1553eaf4d2295b7a8733a357b30def2dcbc357dd80c1e5eda4ecd2b550aecfd03aee7322c06b0bac1eb72d474f6a3ac47db13290fd3383142f77
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
##2017.09.11 ms_rest_azure version 0.9.0
|
2
|
+
* [Breaking Change] Managed Service Identity authentication to acquire token does not require `tenant_id`.[Issue #930](https://github.com/Azure/azure-sdk-for-ruby/issues/930) [PR #931](https://github.com/Azure/azure-sdk-for-ruby/pull/931)
|
3
|
+
|
1
4
|
##2017.08.28 ms_rest_azure version 0.8.2
|
2
5
|
* Enable Managed Service Identity authentication features into ms_rest_azure runtime for azure_mgmt_* sdks.[Issue #884](https://github.com/Azure/azure-sdk-for-ruby/issues/884) [PR #889](https://github.com/Azure/azure-sdk-for-ruby/pull/889)
|
3
6
|
|
@@ -27,7 +30,7 @@
|
|
27
30
|
* Improved AzureOperationError class to expose error_message and error_code properties [#1450](https://github.com/Azure/autorest/pull/1450)
|
28
31
|
|
29
32
|
##2016.09.15 ms_rest_azure version 0.5.0
|
30
|
-
* Updating ms_rest
|
33
|
+
* Updating ms_rest dependency to version 0.5.0
|
31
34
|
* Adding known Azure Environments in ruby runtime for easy discovery
|
32
35
|
* Default Azure active directory url is updated from `https://login.windows.net/` to `https://login.microsoftonline.com/` (Breaking Change)
|
33
36
|
* Using bundled default ca-cert from ms_rest
|
data/README.md
CHANGED
@@ -37,16 +37,16 @@ To start working on the gem the only additional dev dependecy is required - rspe
|
|
37
37
|
Reference it in the gemfile and also add this line to your client's gemspec file:
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.
|
40
|
+
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.9.0'
|
41
41
|
```
|
42
42
|
Don't forget to correct the version.
|
43
43
|
|
44
44
|
# Utilizing MSI(Managed Service Identity) Token Provider
|
45
45
|
|
46
|
-
MSI support has been enabled in `ms_rest_azure` version `0.
|
46
|
+
MSI support has been enabled in `ms_rest_azure` version `0.9.0`. Below code snippet demonstrates how to use MSITokenProvider with default port `50342`:
|
47
47
|
|
48
48
|
```ruby
|
49
|
-
provider = MsRestAzure::MSITokenProvider.new(
|
49
|
+
provider = MsRestAzure::MSITokenProvider.new()
|
50
50
|
credentials = MsRest::TokenCredentials.new(provider)
|
51
51
|
```
|
52
52
|
|
@@ -11,15 +11,12 @@ module MsRestAzure
|
|
11
11
|
private
|
12
12
|
|
13
13
|
TOKEN_ACQUIRE_URL = 'http://localhost:{port}/oauth2/token'
|
14
|
-
REQUEST_BODY_PATTERN = '
|
14
|
+
REQUEST_BODY_PATTERN = 'resource={resource_uri}'
|
15
15
|
DEFAULT_SCHEME = 'Bearer'
|
16
16
|
|
17
17
|
# @return [MSIActiveDirectoryServiceSettings] settings.
|
18
18
|
attr_accessor :settings
|
19
19
|
|
20
|
-
# @return [String] tenant id (also known as domain).
|
21
|
-
attr_accessor :tenant_id
|
22
|
-
|
23
20
|
# @return [Integer] port number where MSI service is running.
|
24
21
|
attr_accessor :port
|
25
22
|
|
@@ -39,16 +36,13 @@ module MsRestAzure
|
|
39
36
|
|
40
37
|
#
|
41
38
|
# Creates and initialize new instance of the MSITokenProvider class.
|
42
|
-
# @param tenant_id [String] tenant id (also known as domain).
|
43
39
|
# @param port [Integer] port number where MSI service is running.
|
44
40
|
# @param settings [ActiveDirectoryServiceSettings] active directory setting.
|
45
|
-
def initialize(
|
46
|
-
fail ArgumentError, 'Tenant id cannot be nil' if tenant_id.nil?
|
41
|
+
def initialize(port = 50342, settings = ActiveDirectoryServiceSettings.get_azure_settings)
|
47
42
|
fail ArgumentError, 'Port cannot be nil' if port.nil?
|
48
43
|
fail ArgumentError, 'Port must be an Integer' unless port.is_a? Integer
|
49
44
|
fail ArgumentError, 'Azure AD settings cannot be nil' if settings.nil?
|
50
45
|
|
51
|
-
@tenant_id = tenant_id
|
52
46
|
@port = port
|
53
47
|
@settings = settings
|
54
48
|
|
@@ -90,12 +84,11 @@ module MsRestAzure
|
|
90
84
|
end
|
91
85
|
|
92
86
|
request_body = REQUEST_BODY_PATTERN.dup
|
93
|
-
request_body['{authentication_endpoint}'] = ERB::Util.url_encode(@settings.authentication_endpoint)
|
94
|
-
request_body['{tenant_id}'] = ERB::Util.url_encode(@tenant_id)
|
95
87
|
request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience)
|
96
88
|
|
97
89
|
response = connection.post do |request|
|
98
90
|
request.headers['content-type'] = 'application/x-www-form-urlencoded'
|
91
|
+
request.headers['Metadata'] = 'true'
|
99
92
|
request.body = request_body
|
100
93
|
end
|
101
94
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ms_rest_azure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|