Skip to content

Commit

Permalink
Fixed Azure#18739, Also radically simplified the experience of using …
Browse files Browse the repository at this point in the history
…the policy and policy management APIs
  • Loading branch information
LarryOsterman committed Mar 31, 2021
1 parent f0c1639 commit 6fecea9
Show file tree
Hide file tree
Showing 8 changed files with 380 additions and 165 deletions.
44 changes: 40 additions & 4 deletions sdk/attestation/Azure.Security.Attestation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
# Release History

## 1.0.0-beta.2 (2021-04-15)
## 1.0.0-beta.2 (2021-04-06)

- Fixed bug #19708, handle JSON values that are not just simple integers.
- Fixed bug #18183, Significant cleanup of README.md.
- Fixed bug #18739, reference the readme.md file in the azure-rest-apis directory instead of referencing the attestation JSON file directly. Also updated to the most recent version of the dataplane swagger files.

### Breaking Changes:
It is no longer necessary to manually Base64Url encode the AttestationPolicy property in the StoredAttestationPolicy model.
This simplifies the user experience for interacting with the saved attestation policies - developers can treat attestation policies as string values.
### Breaking Changes since 1.0.0-beta.1:
- It is no longer necessary to manually Base64Url encode the AttestationPolicy property in the StoredAttestationPolicy model.
This dramatically simplifies the user experience for interacting with the saved attestation policies - developers can treat attestation policies as string values.
- The `SecuredAttestationToken` and `UnsecuredAttestationToken` parameters have been removed from the APIs which took them. Instead those APIs directly take the underlying type.

Before:
```
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
var policyTokenSigner = TestEnvironment.PolicyCertificate0;
AttestationToken policySetToken = new SecuredAttestationToken(
new StoredAttestationPolicy { AttestationPolicy = attestationPolicy, },
TestEnvironment.PolicySigningKey0,
policyTokenSigner);
var setResult = client.SetPolicy(AttestationType.SgxEnclave, policySetToken);
```
After:
```
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
var setResult = client.SetPolicy(AttestationType.SgxEnclave, attestationPolicy, TestEnvironment.PolicySigningKey0, policyTokenSigner);
```


- The `GetPolicy` API has been changed to directly return the policy requested instead of a `StoredAttestationPolicy` object.

Before:
```
var policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
var result = policyResult.Value.AttestationPolicy;
```
After:
```
string policy = await client.GetPolicyAsync(AttestationType.SgxEnclave);
```

The net result of these changes is a significant reduction in the complexity of interacting with the attestation administration APIs.

## 1.0.0-beta.1 (2021-01-15)
Released as beta, not alpha.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@ public class AttestationResponse<T> : Response<T>
{
private readonly AttestationToken _token;
private readonly Response _response;
private readonly T _body;

internal AttestationResponse(Response response, AttestationToken underlyingToken) : base()
/// <summary>
/// Represents a response from the Microsoft Azure Attestation service.
/// </summary>
/// <param name="response">The underlying response object corresponding to the original request,</param>
/// <param name="underlyingToken">The attestation token returned from the attestation service.</param>
/// <param name="body">The optional value of the body of the token to be returned to the customer. If none is provided, then the body will be retrieved from the attestation token.</param>
internal AttestationResponse(Response response, AttestationToken underlyingToken, T body = default(T)) : base()
{
_response = response;
_token = underlyingToken;
_body = body;
}

/// <inheritdoc/>
public override T Value => _token.GetBody<T>();
public override T Value => _body?? _token.GetBody<T>();

/// <summary>
/// Returns the raw attestation token returned from the Microsoft Azure Attestation service.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions sdk/attestation/Azure.Security.Attestation/src/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ Run `dotnet build /t:GenerateCode` in src directory to re-generate.

``` yaml
title: Azure.Security.Attestation
input-file:
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f0356ad28dd559e4d52b2aa679242a42fa3dc176/specification/attestation/data-plane/Microsoft.Attestation/stable/2020-10-01/attestation.json
require:
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/45c7ae94a46920c94b5e03e6a7d128d6cb7a364e/specification/attestation/data-plane/readme.md
namespace: Azure.Security.Attestation
tag: package-2020-10-01
azure-arm: false


directive:
- from: swagger-document
Expand Down

0 comments on commit 6fecea9

Please sign in to comment.