azure-rest-api-specs icon indicating copy to clipboard operation
azure-rest-api-specs copied to clipboard

Enable custom skypetoken expiration for a 2nd API in the new 2021-10-01 version

Open cemateia opened this issue 3 years ago • 7 comments

Tracked with issue: #20040 Changes in this PR enable the possibility for the customers to issue skypetokens with a custom expiration time.
https://microsoft.sharepoint-df.com/:w:/t/IC3SDK/EYZbS36x9IVMq9NZfRhPqDgB3hhPAuoZEcbNIFJQOvWEJQ?e=Z25Rte

This PR is a follow-up for the functionality reviewed here: https://github.com/Azure/azure-rest-api-specs/pull/19268 The functionality was not yet released. It has been recently decided to add the same functionality to a second API. This PR updates the swagger to support the custom token expiration functionality on the second API.

Changelog

Add a changelog entry for this PR by answering the following questions:

  1. What's the purpose of the update?
    • [x] new API version
  2. When are you targeting to deploy the new service/feature to public regions? Please provide the date or, if the date is not yet available, the month. October 2022
  3. When do you expect to publish the swagger? Please provide date or, the date is not yet available, the month. October 2022
  4. If updating an existing version, please select the specific language SDKs and CLIs that must be refreshed after the swagger is published.
    • [x] SDK of .NET (need service team to ensure code readiness)
    • [x] SDK of Python
    • [x] SDK of Java
    • [x] SDK of Js

Contribution checklist:

If any further question about AME onboarding or validation tools, please view the FAQ.

Functionality description

The main goal of this feature is to allow developers who use ACS (directly or via SDKs) to customize the skypetokens validity. Until now, ACS only provided the possibility for customers to generate skypetokens for a predefined validity period of 24 hours. This functionality will introduce the possibility for customers to generate skypetokens with a custom validity period within the [1-24] hours range. Customers can make requests for issuing a skypetoken without providing a validity period. In this situation, we will generate a skypetoken with a default validity of 24 hours. Customers can make requests to issue skypetokens for a custom validity period by providing the validity interval in the request's body. Accepted values are within [1-24] hours range. For this, we are introducing a new optional integer parameter that will hold the validity time in minutes (expiresInMinutes).

This optional parameter will be available in two APIs. The API for generation of skypetokend and the API for generation of identity together with a skypetoken.

Customers that do not want to use this functionality will be able to issue skypetokens the same way they did before. No breaking change will be introduced.

For behaviors on the API for generation of skypetokens, please see the previous PR.

This PR introduces changes only to the API that generates and identity together with a skypetoken.

Old behavior - issue identity and access token for a predefined validity period of 24 hours

ACS Auth receives a request to issue an identity with skypetoken. There is no possibility to specify a validity period. ACS Auth sets the validity for all skypetokens to a default value of 24 hours. ACS Auth generates and identity and then makes a request to Skypetoken Issuer to generate a skypetoken for this identity, valid for 24 hours. ACS Auth returns the new identity and skypetoken to the customer. old flow - generate identity with token - predefined expiration time

New behavior - issue identity and access token for a custom validity

ACS Auth receives a request to issue an identity with skypetoken. Customer can specify a validity period within the [1-24] hours range.

a. Customer does not specify a validity for the skypetoken ACS Auth sets the validity for current skypetoken to a default value of 24 hours. ACS Auth generates an identity and makes a request to Skypetoken Issuer to generate a skypetoken valid for 24 hours. ACS Auth returns the new identity and skypetoken to the customer.

b. Customer specifies a custom token validity within the [1-24] hours range ACS Auth generates an identity and makes a request to Skypetoken Issuer to generate a skypetoken valid for a custom validity. ACS Auth returns the new identity and skypetoken to the customer.

If the specified custom validity is outside the permitted range of [1-24] hours, ACS Auth returns 400 BadRequest.

new flow - generate identity with token - custom expiration time

Review documentation

Differences from previous version Design document

Code snippet C#

Previous version 2022-06-01 Generate an identity with token valid for 24 hours

// Issue an access token with the "voip" scope for a new identity // Issue an identity and an access token with the "voip" scope for the new identity var identityAndTokenResponse = await client.CreateUserAndTokenAsync(scopes: new[] { CommunicationTokenScope.VoIP });

// Get the token from the response var token = tokenResponse.Value.Token; var expiresOn = tokenResponse.Value.ExpiresOn;

New version 2022-10-01 Generate a token valid for 24 hours

// Issue an access token with the "voip" scope for a new identity var identityAndTokenResponse = await client.CreateUserAndTokenAsync(scopes: new[] { CommunicationTokenScope.VoIP });

Generate an identity with a token valid for 60 min

// Issue an access token with the "voip" scope for an identity var identityAndTokenResponse = await client.CreateUserAndTokenAsync(scopes: new[] { CommunicationTokenScope.VoIP }, TimeSpan.FromMinutes(60));

~~Breaking Change Review Checklist~~ No breaking changes

If any of the following scenarios apply to the PR, request approval from the Breaking Change Review Board as defined in the Breaking Change Policy.

  • [ ] Removing API(s) in a stable version
  • [ ] Removing properties in a stable version
  • [ ] Removing API version(s) in a stable version
  • [ ] Updating API in a stable or public preview version with Breaking Change Validation errors
  • [ ] Updating API(s) in public preview over 1 year (refer to Retirement of Previews)

Action: to initiate an evaluation of the breaking change, create a new intake using the template for breaking changes. Addition details on the process and office hours are on the Breaking change Wiki.

Please follow the link to find more details on PR review process. fix https://github.com/Azure/azure-rest-api-specs/issues/20093

cemateia avatar Aug 01 '22 14:08 cemateia

Hi, @cemateia Thanks for your PR. I am workflow bot for review process. Here are some small tips.

  • Please ensure to do self-check against checklists in first PR comment.
  • PR assignee is the person auto-assigned and responsible for your current PR reviewing and merging.
  • For specs comparison cross API versions, Use API Specs Comparison Report Generator
  • If there is CI failure(s), to fix CI error(s) is mandatory for PR merging; or you need to provide justification in PR comment for explanation. How to fix?
  • Any feedback about review process or workflow bot, pls contact swagger and tools team. [email protected]

    Swagger Validation Report

    ️❌BreakingChange: 4 Errors, 0 Warnings failed [Detail]
    compared swaggers (via Oad v0.9.7)] new version base version
    CommunicationIdentity.json 2022-10-01(c7815e7) 2022-10-01(main)
    Rule Message
    1027 - DefaultValueChanged The new version has a different default value than the previous one.
    New: Identity/stable/2022-10-01/CommunicationIdentity.json#L286:9
    Old: Identity/stable/2022-10-01/CommunicationIdentity.json#L286:9
    1036 - ConstraintChanged The new version has a different 'maximum' value than the previous one.
    New: Identity/stable/2022-10-01/CommunicationIdentity.json#L286:9
    Old: Identity/stable/2022-10-01/CommunicationIdentity.json#L286:9
    1036 - ConstraintChanged The new version has a different 'minimum' value than the previous one.
    New: Identity/stable/2022-10-01/CommunicationIdentity.json#L286:9
    Old: Identity/stable/2022-10-01/CommunicationIdentity.json#L286:9
    1045 - AddedOptionalProperty The new version has a new optional property 'expiresInMinutes' that was not found in the old version.
    New: Identity/stable/2022-10-01/CommunicationIdentity.json#L313:7
    Old: Identity/stable/2022-10-01/CommunicationIdentity.json#L310:7
    ️️✔️Breaking Change(Cross-Version) succeeded [Detail] [Expand]
    There are no breaking changes.
    ️️✔️CredScan succeeded [Detail] [Expand]
    There is no credential detected.
    ️⚠️LintDiff: 0 Warnings warning [Detail]
    compared tags (via openapi-validator v1.13.0) new version base version
    package-2022-10 package-2022-10(c7815e7) package-2022-10(main)

    The following errors/warnings exist before current PR submission:

    Rule Message
    :warning: R2063 - OperationIdNounConflictingModelNames OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'CommunicationIdentityModel'. Consider using the plural form of 'CommunicationIdentity' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Identity/stable/2022-10-01/CommunicationIdentity.json#L15
    :warning: R2063 - OperationIdNounConflictingModelNames OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'CommunicationIdentityModel'. Consider using the plural form of 'CommunicationIdentity' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Identity/stable/2022-10-01/CommunicationIdentity.json#L62
    :warning: R2063 - OperationIdNounConflictingModelNames OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'CommunicationIdentityModel'. Consider using the plural form of 'CommunicationIdentity' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Identity/stable/2022-10-01/CommunicationIdentity.json#L102
    :warning: R2063 - OperationIdNounConflictingModelNames OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'CommunicationIdentityModel'. Consider using the plural form of 'CommunicationIdentity' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Identity/stable/2022-10-01/CommunicationIdentity.json#L142
    :warning: R2063 - OperationIdNounConflictingModelNames OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'CommunicationIdentityModel'. Consider using the plural form of 'CommunicationIdentity' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Identity/stable/2022-10-01/CommunicationIdentity.json#L190
    ️️✔️Avocado succeeded [Detail] [Expand]
    Validation passes for Avocado.
    ️️✔️ApiReadinessCheck succeeded [Detail] [Expand]
    ️️✔️~[Staging] ServiceAPIReadinessTest succeeded [Detail] [Expand]
    Validation passes for ServiceAPIReadinessTest.
    ️️✔️ModelValidation succeeded [Detail] [Expand]
    Validation passes for ModelValidation.
    ️️✔️SemanticValidation succeeded [Detail] [Expand]
    Validation passes for SemanticValidation.
    ️️✔️PoliCheck succeeded [Detail] [Expand]
    Validation passed for PoliCheck.
    ️️✔️SDK Track2 Validation succeeded [Detail] [Expand]
    Validation passes for SDKTrack2Validation

    • The following tags are being changed in this PR
      • "https://github.com/Azure/azure-rest-api-specs/blob/c7815e7dd249a55ebc2f1f955f729593c096da0d/specification/communication/data-plane/Identity/readme.md#tag-package-2022-10">communication/data-plane/Identity/readme.md#package-2022-10
    ️️✔️PrettierCheck succeeded [Detail] [Expand]
    Validation passes for PrettierCheck.
    ️️✔️SpellCheck succeeded [Detail] [Expand]
    Validation passes for SpellCheck.
    ️️✔️Lint(RPaaS) succeeded [Detail] [Expand]
    Validation passes for Lint(RPaaS).
    ️️✔️CadlValidation succeeded [Detail] [Expand]
    Validation passes for CadlValidation.
    Posted by Swagger Pipeline | How to fix these errors?

    Swagger pipeline restarted successfully, please wait for status update in this comment.

    Swagger pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment.

    NewApiVersionRequired reason: A service’s API is a contract with customers and is represented by using the api-version query parameter. Changes such as adding an optional property to a request/response or introducing a new operation is a change to the service’s contract and therefore requires a new api-version value. This is critically important for documentation, client libraries, and customer support. EXAMPLE: if a customer calls a service in the public cloud using api-version=2020-07-27, the new property or operation may exist but if they call the service in a government cloud, air-gapped cloud, or Azure Stack Hub cloud using the same api-version, the property or operation may not exist. Because there is no clear relationship between the service api-version and the new property/operation, customers can’t trust the documentation and Azure customer have difficulty helping customers diagnose issues. In addition, each client library version documents the service version it supports. When an optional property or new operation is added to a service and its Swagger, new client libraries must be produced to expose this functionality to customers. Without updating the api-version, it is unclear to customers which version of a client library supports these new features.

    Hi @cemateia, one or multiple breaking change(s) is detected in your PR. Please check out the breaking change(s), and provide business justification in the PR comment and @ PR assignee why you must have these change(s), and how external customer impact can be mitigated. Please ensure to follow breaking change policy to request breaking change review and approval before proceeding swagger PR review. Action: To initiate an evaluation of the breaking change, create a new intake using the template for breaking changes. Addition details on the process and office hours are on the Breaking change Wiki. If you want to know the production traffic statistic, please see ARM Traffic statistic. If you think it is false positive breaking change, please provide the reasons in the PR comment, report to Swagger Tooling Team via https://aka.ms/swaggerfeedback. Note: To avoid breaking change, you can refer to Shift Left Solution for detecting breaking change in early phase at your service code repository.

    @mikekistler I've filed an issue about the breaking changes policy not being accessible: https://github.com/microsoft/api-guidelines/issues/384

    The last manual copy that I own showed adding an optional property as a non-breaking change that requires a version bump, so I'm surprised by the automation failure which also doesn't explain why this is now considered breaking (1045-AddedOptionalProperty)

    DominikMe avatar Aug 09 '22 22:08 DominikMe

    Breaking change intake is also approved: https://msazure.visualstudio.com/One/_workitems/edit/15336873 Removed minLength from swagger and added official min, max and default values.

    @scgbear , @MushMal , @mikekistler, could you please take a look and approve? Thanks!

    cemateia avatar Aug 22 '22 15:08 cemateia