Skip to content

Commit

Permalink
Merge pull request #92 from autodesk-platform-services/Release-V2
Browse files Browse the repository at this point in the history
Merge Release v2 to Main
  • Loading branch information
sajith-subramanian authored Sep 19, 2024
2 parents f2427ec + 4be148b commit f48390f
Show file tree
Hide file tree
Showing 129 changed files with 3,847 additions and 1,727 deletions.
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing to APS SDK

We work hard to provide an excellent SDK for the Autodesk community, and we greatly appreciante your feedback and contributions. Please read through this document before submitting any issues or pull requests.

For general questions (_how to_), please use the [APS Get Help](https://aps.autodesk.com/get-help) form. We strongly encourage using [StackOverflow](http://stackoverflow.com/tags/autodesk-platform-services).

## Before you start

- **Search before you file a new Issue or Pull Request**. Add to tickets if you have new information about the issue.
- **Keep it short but complete**. Make sure you include all the context needed to solve the problem.

## Issues

- **Bug Report**: if you believe you encounter a problem using any of the APS SDKs, please create a new issue with enough information to reproduce the issue (e.g. code snippet that triggers the problem). Please review existing issues before starting a new.

- **Feature Request**: please use the [APS Public Roadmap](https://aps.autodesk.com/aps-roadmap) instead.

## Pull Request

Pull Requests are the best way to propose changes to the APS SDK code. Always use `main` branch as a starting point (we do our best to keep that up to date with published versions). Please use [fork & pull](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#fork--pull).

Please use a **Title** that summarizes the proposal, and a **Description** with a complete description of what it does and list of changes implemented. The APS team will triage, review, and if aplicable, merge into the appropriate `dev` branch.

All contributions will be licensed under the Apache 2.0 license.

10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The Developer Portal has everything APS:
## Nuget Packages

- [Authentication](https://www.nuget.org/packages/Autodesk.Authentication)
- [Construction Account Admin](https://www.nuget.org/packages/Autodesk.Construction.AccountAdmin/1.0.0-beta1)
- [Construction Issues](https://www.nuget.org/packages/Autodesk.Construction.Issues)
- [ACC Account Admin](https://www.nuget.org/packages/Autodesk.Construction.AccountAdmin/1.0.0-beta1)
- [ACC Issues](https://www.nuget.org/packages/Autodesk.Construction.Issues)
- [Data Management](https://www.nuget.org/packages/Autodesk.DataManagement)
- [Model Derivative](https://www.nuget.org/packages/Autodesk.ModelDerivative)
- [OSS](https://www.nuget.org/packages/Autodesk.Oss)
Expand All @@ -32,4 +32,8 @@ The Developer Portal has everything APS:

#### Looking for Design Automation v3?

The Design Automation .NET is maintained in a separate [repo](https://github.com/Autodesk-Forge/forge-api-dotnet-design.automation) and [nuget package](https://www.nuget.org/packages/Autodesk.Forge.DesignAutomation).
The Design Automation .NET is maintained in a separate [repo](https://github.com/Autodesk-Forge/forge-api-dotnet-design.automation) and [nuget package](https://www.nuget.org/packages/Autodesk.Forge.DesignAutomation).

## Contributions

Contributions are welcome! Please make sure to read the [contribution guidelines](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion authentication/source/Autodesk.Authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageDescription>Client SDK for Authentication API</PackageDescription>
<Copyright>Autodesk Inc.</Copyright>
<PackageId>Autodesk.Authentication</PackageId>
<PackageVersion>2.0.0-beta</PackageVersion>
<PackageVersion>2.0.0-beta2</PackageVersion>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/autodesk-platform-services/aps-sdk-net.git</RepositoryUrl>
Expand Down
42 changes: 38 additions & 4 deletions authentication/source/custom-code/AuthenticationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ namespace Autodesk.Authentication

public class AuthenticationClient
{
/// <summary>
/// Gets the token API instance.
/// </summary>
public ITokenApi tokenApi { get; }
/// <summary>
/// Gets the users API instance.
/// </summary>
public IUsersApi usersApi { get; }

public AuthenticationClient(SDKManager.SDKManager sDKManager)
/// <summary>
/// Initializes a new instance of the <see cref="AuthenticationClient"/> class.
/// </summary>
/// <param name="sdkManager">The SDK manager instance.</param>
public AuthenticationClient(SDKManager.SDKManager sdkManager)
{
this.tokenApi = new TokenApi(sDKManager);
this.usersApi = new UsersApi(sDKManager);
this.tokenApi = new TokenApi(sdkManager);
this.usersApi = new UsersApi(sdkManager);
}


Expand All @@ -39,6 +49,9 @@ public AuthenticationClient(SDKManager.SDKManager sDKManager)
/// <param name="authorization">
/// The 3-legged access token of the currently logged in user.
/// </param>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of ApiResponse&lt;UserInfo&gt;</returns>

public async System.Threading.Tasks.Task<UserInfo> GetUserInfoAsync(string authorization, bool throwOnError = true)
Expand Down Expand Up @@ -68,6 +81,9 @@ public async System.Threading.Tasks.Task<UserInfo> GetUserInfoAsync(string autho
/// <param name="scopes">
///A list of requested scopes. See the [Developer's Guide documentation on scopes](/en/docs/oauth/v2/developers_guide/scopes/) for a list of valid values you can provide.
/// </param>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of &lt;TwoLeggedToken&gt;</returns>
public async System.Threading.Tasks.Task<TwoLeggedToken> GetTwoLeggedTokenAsync(string clientId, string clientSecret, List<Scopes> scopes, bool throwOnError = true)
{
Expand Down Expand Up @@ -170,6 +186,9 @@ public async System.Threading.Tasks.Task<TwoLeggedToken> GetTwoLeggedTokenAsync(
/// <param name="codeVerifier">
///A random URL-encoded string between 43 characters and 128 characters. In a PKCE grant flow, the authentication server uses this string to verify the code challenge that was passed when you called [Authorize User](/en/docs/oauth/v2/reference/http/authorize-GET/). Required if [`code_challenge` was specified when you called [Authorize User](/en/docs/oauth/v2/reference/http/authorize-GET/). (optional)
/// </param>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of &lt;ThreeLeggedToken&gt;</returns>
public async System.Threading.Tasks.Task<ThreeLeggedToken> GetThreeLeggedTokenAsync(string clientId, string code, string redirectUri, string clientSecret = default(string), string codeVerifier = default(string), bool throwOnError = true)
{
Expand Down Expand Up @@ -210,8 +229,11 @@ public async System.Threading.Tasks.Task<TwoLeggedToken> GetTwoLeggedTokenAsync(
///A URL-encoded space-delimited list of requested scopes. See the [Developer's Guide documentation on scopes](/en/docs/oauth/v2/developers_guide/scopes/) for a list of valid values you can provide.
///If specified, scopes have to be primarily same with or a subset of the scopes used to generate the refresh_token.(optional)
/// </param>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of &lt;ThreeLeggedToken&gt;</returns>
public async System.Threading.Tasks.Task<ThreeLeggedToken> RefreshTokenAsync(string clientId, string clientSecret, string refreshToken, List<Scopes> scopes = null, bool throwOnError = true)
public async System.Threading.Tasks.Task<ThreeLeggedToken> RefreshTokenAsync(string refreshToken, string clientId, string clientSecret = default(string), List<Scopes> scopes = null, bool throwOnError = true)
{

if (!string.IsNullOrEmpty(clientSecret))
Expand Down Expand Up @@ -242,6 +264,9 @@ public async System.Threading.Tasks.Task<ThreeLeggedToken> RefreshTokenAsync(str
///See the Developer's Guide topic on [Asymmetric Signing](/en/docs/oauth/v2/developers_guide/asymmetric-encryption/) for more information.
/// </remarks>
/// <exception cref="AuthenticationApiException">Thrown when fails to make API call</exception>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of &lt;Jwks&gt;></returns>

public async System.Threading.Tasks.Task<Jwks> GetKeysAsync(bool throwOnError = true)
Expand All @@ -257,6 +282,9 @@ public async System.Threading.Tasks.Task<Jwks> GetKeysAsync(bool throwOnError =
///Returns an OpenID Connect Discovery Specification compliant JSON document. It contains a list of the OpenID/OAuth endpoints, supported scopes, claims, public keys used to sign the tokens, and other details.
/// </remarks>
/// <exception cref="AuthenticationApiException">Thrown when fails to make API call</exception>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of &lt;OidcSpec&gt;></returns>
public async System.Threading.Tasks.Task<OidcSpec> GetOidcSpecAsync(bool throwOnError = true)
{
Expand Down Expand Up @@ -286,6 +314,9 @@ public async System.Threading.Tasks.Task<OidcSpec> GetOidcSpecAsync(bool throwOn
/// <param name="clientId">
///The Client ID of the calling application, as registered with APS.
/// </param>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of &lt;IntrospectToken&gt;></returns>
public async System.Threading.Tasks.Task<IntrospectToken> IntrospectTokenAsync(string token, string clientId, string clientSecret = default(string), bool throwOnError = true)
{
Expand Down Expand Up @@ -349,6 +380,9 @@ public async System.Threading.Tasks.Task<OidcSpec> GetOidcSpecAsync(bool throwOn
/// <param name="clientId">
///The Client ID of the calling application, as registered with APS.
/// </param>
/// <param name="throwOnError">
/// Indicates whether to throw an exception on error.
/// </param>
/// <returns>Task of HttpResponseMessage</returns>

public async System.Threading.Tasks.Task<HttpResponseMessage> RevokeAsync(string token, string clientId, string clientSecret = default(string), TokenTypeHint tokenTypeHint = default(TokenTypeHint), bool throwOnError = true)
Expand Down
3 changes: 2 additions & 1 deletion authentication/test/Autodesk.Authentication.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -13,6 +12,8 @@
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\source\Autodesk.Authentication.csproj"/>
</ItemGroup>

Expand Down
21 changes: 12 additions & 9 deletions authentication/test/TestAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public class TestAuthentication
string client_id = "<client_id>";
string client_secret = "<client_secret>";

string authorization_code = "code";
string redirect_uri = @"redirect_uri";
string authorization_code = "<authorization_code>";
string redirect_uri = @"<redirect_uri>";

string token = "<token>";
string threeLeggedTokenAccesstoken = "<three_legged_token_accesstoken>";
string refreshToken = "<refresh_token>";

[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
Expand Down Expand Up @@ -56,11 +60,10 @@ public async Task Test3LeggedTokenAsync()
Assert.IsNotNull(threeLeggedToken_accesstoken);
}


[TestMethod]
public async Task TestRefreshTokenAsync()
{
ThreeLeggedToken newToken = await _authClient.RefreshTokenAsync(client_id, client_secret, "refreshToken");
ThreeLeggedToken newToken = await _authClient.RefreshTokenAsync("refreshToken", client_id, client_secret);
Assert.IsNotNull(newToken.AccessToken);
}

Expand All @@ -82,23 +85,23 @@ public async Task TestOidcSpecAsync()
[TestMethod]
public async Task TestUserInfoAsync()
{
UserInfo userInfo = await _authClient.GetUserInfoAsync("threeLeggedToken_accesstoken");
UserInfo userInfo = await _authClient.GetUserInfoAsync(threeLeggedTokenAccesstoken);
Assert.IsNotNull(userInfo);
}

[TestMethod]

public async Task TestIntrospectTokenAsync()
{
IntrospectToken introspectToken = await _authClient.IntrospectTokenAsync("token", client_id, client_secret);
var exp = introspectToken.Exp;
Assert.IsNotNull(exp);
IntrospectToken introspectToken = await _authClient.IntrospectTokenAsync(token, client_id, client_secret);
var exp = introspectToken.Exp;
Assert.IsNotNull(exp);
}

[TestMethod]
public async Task TestRevokeTokenAsync()
{
HttpResponseMessage response = await _authClient.RevokeAsync("token", client_id,client_secret);
HttpResponseMessage response = await _authClient.RevokeAsync(token, client_id, client_secret);
Assert.IsTrue(response.IsSuccessStatusCode);
}

Expand Down
76 changes: 0 additions & 76 deletions construction/accountadmin/Model/ContractType.gen.cs

This file was deleted.

58 changes: 0 additions & 58 deletions construction/accountadmin/Model/Language.gen.cs

This file was deleted.

Loading

0 comments on commit f48390f

Please sign in to comment.