Skip to content

Commit

Permalink
Update System.IdentityModel.Tokens.Jwt dependency to 7.2.0. (#690)
Browse files Browse the repository at this point in the history
* Update System.IdentityModel.Tokens.Jwt dependency to 7.2.0.
* Enable additional properties for SamlApplicationSettingsApplication.
* Update WireMock dependency
* Add UT to verify additionalProperties can be retrieved from SamlApplicationSettingsApp model.
* Update changelog
  • Loading branch information
laura-rodriguez authored Jan 26, 2024
1 parent 1e1cae0 commit c915413
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 13 deletions.
2 changes: 1 addition & 1 deletion API_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Allows customers to easily access the Okta Management APIs
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 5.1.0
- SDK version: 7.0.3
- SDK version: 7.0.4
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
For more information, please visit [https://developer.okta.com/](https://developer.okta.com/)

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
Running changelog of releases since `3.1.1`

## 7.0.4

- Update vulnerable `System.IdentityModel.Tokens.Jwt` dependency (OKTA-683207)
- Fix "Missing application settings when fetching SamlApplication" (#644)

## 7.0.3

- Fix "Missing data in verifyFactorRequest prevents verifying webauthn" (OKTA-656179)
Expand Down
2 changes: 1 addition & 1 deletion openapi3/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"packageName" : "Okta.Sdk",
"outputDir" : "../",
"inputSpec" : "./management.yaml",
"packageVersion" : "7.0.3",
"packageVersion" : "7.0.4",
"packageDescription" : "Official .NET SDK for the Okta API",
"packageTitle" : "Official .NET SDK for the Okta API",
"packageCompany" : "Okta, Inc.",
Expand Down
1 change: 1 addition & 0 deletions openapi3/management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30001,6 +30001,7 @@ components:
$ref: '#/components/schemas/SamlApplicationSettingsSignOn'
SamlApplicationSettingsApplication:
type: object
additionalProperties: true
properties:
acsUrl:
type: string
Expand Down
4 changes: 2 additions & 2 deletions openapi3/templates/netcore_project.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Okta.Sdk.Abstractions" Version="4.0.4" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.22.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.2.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" />
{{/useGenericHost}}
{{#useRestSharp}}
<PackageReference Include="RestSharp" Version="110.2.0" />
Expand Down
90 changes: 90 additions & 0 deletions src/Okta.Sdk.UnitTest/Api/ApplicationApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,5 +399,95 @@ private string GetOAuthTokenStubResponse()

return rawResponse;
}

[Fact]
public async Task GetSamlApplicationSettingsAppAdditionalProperties()
{
var samlAppStub = @"{
""id"": ""<id>"",
""name"": ""salesforce"",
""label"": ""Salesforce.com"",
""status"": ""ACTIVE"",
""lastUpdated"": ""2023-05-09T14:01:21.000Z"",
""created"": ""2023-05-09T13:58:16.000Z"",
""accessibility"": {
""selfService"": false,
""errorRedirectUrl"": null,
""loginRedirectUrl"": null
},
""licensing"": {
""seatCount"": 0
},
""visibility"": {
""autoLaunch"": false,
""autoSubmitToolbar"": true,
""hide"": {
""iOS"": false,
""web"": false
},
""appLinks"": {
""mc"": true
}
},
""features"": [],
""signOnMode"": ""SAML_2_0"",
""credentials"": {
""userNameTemplate"": {
""template"": ""${source.login}"",
""type"": ""BUILT_IN""
},
""signing"": {
""kid"": ""<kid>""
}
},
""settings"": {
""app"": {
""integrationType"": ""STANDARD"",
""siteURL"": null,
""loginUrl"": ""https://<domain>.my.salesforce.com"",
""logoutUrl"": null,
""instanceType"": ""PRODUCTION"",
""portalID"": null,
""orgID"": null,
""customDomain"": ""<domain>""
},
""notifications"": {
""vpn"": {
""network"": {
""connection"": ""DISABLED""
},
""message"": null,
""helpUrl"": null
}
},
""notes"": {
""admin"": null,
""enduser"": null
},
""signOn"": {
""defaultRelayState"": null,
""ssoAcsUrlOverride"": null,
""audienceOverride"": null,
""recipientOverride"": null,
""destinationOverride"": null,
""attributeStatements"": []
}
}
}";

var mockClient = new MockAsyncClient(samlAppStub, HttpStatusCode.OK);
var appApi = new ApplicationApi(mockClient, new Configuration { BasePath = "https://foo.com" });

var samlApp = await appApi.GetApplicationAsync("foo") as SamlApplication;
samlApp.Settings.App.AdditionalProperties["integrationType"].Should().Be("STANDARD");
samlApp.Settings.App.AdditionalProperties["siteURL"].Should().BeNull();
samlApp.Settings.App.AdditionalProperties["loginUrl"].Should().Be("https://<domain>.my.salesforce.com");
samlApp.Settings.App.AdditionalProperties["logoutUrl"].Should().BeNull();
samlApp.Settings.App.AdditionalProperties["instanceType"].Should().Be("PRODUCTION");
samlApp.Settings.App.AdditionalProperties["portalID"].Should().BeNull();
samlApp.Settings.App.AdditionalProperties["orgID"].Should().BeNull();
samlApp.Settings.App.AdditionalProperties["customDomain"].Should().Be("<domain>");

}
}
}
2 changes: 1 addition & 1 deletion src/Okta.Sdk.UnitTest/Okta.Sdk.UnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
<PackageReference Include="WireMock.Net" Version="1.5.40" />
<PackageReference Include="WireMock.Net" Version="1.5.47" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions src/Okta.Sdk/Client/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Configuration : IReadableConfiguration
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "7.0.3";
public const string Version = "7.0.4";

/// <summary>
/// Identifier for ISO 8601 DateTime Format
Expand Down Expand Up @@ -758,7 +758,7 @@ public static string ToDebugReport()
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 5.1.0\n";
report += " SDK Package Version: 7.0.3\n";
report += " SDK Package Version: 7.0.4\n";

return report;
}
Expand Down
18 changes: 15 additions & 3 deletions src/Okta.Sdk/Model/SamlApplicationSettingsApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace Okta.Sdk.Model
/// SamlApplicationSettingsApplication
/// </summary>
[DataContract(Name = "SamlApplicationSettingsApplication")]

public partial class SamlApplicationSettingsApplication : IEquatable<SamlApplicationSettingsApplication>

{

/// <summary>
Expand All @@ -52,6 +52,12 @@ public partial class SamlApplicationSettingsApplication : IEquatable<SamlApplica
[DataMember(Name = "baseUrl", EmitDefaultValue = true)]
public string BaseUrl { get; set; }

/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand All @@ -63,6 +69,7 @@ public override string ToString()
sb.Append(" AcsUrl: ").Append(AcsUrl).Append("\n");
sb.Append(" AudRestriction: ").Append(AudRestriction).Append("\n");
sb.Append(" BaseUrl: ").Append(BaseUrl).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand All @@ -71,7 +78,7 @@ public override string ToString()
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
Expand Down Expand Up @@ -112,7 +119,8 @@ public bool Equals(SamlApplicationSettingsApplication input)
this.BaseUrl == input.BaseUrl ||
(this.BaseUrl != null &&
this.BaseUrl.Equals(input.BaseUrl))
);
)
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
}

/// <summary>
Expand All @@ -137,6 +145,10 @@ public override int GetHashCode()
{
hashCode = (hashCode * 59) + this.BaseUrl.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
}
return hashCode;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Okta.Sdk/Okta.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Description>Official .NET SDK for the Okta API</Description>
<Copyright>Okta, Inc.</Copyright>
<RootNamespace>Okta.Sdk</RootNamespace>
<Version>7.0.3</Version>
<Version>7.0.4</Version>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Okta.Sdk.xml</DocumentationFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
Expand All @@ -26,8 +26,8 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Okta.Sdk.Abstractions" Version="4.0.4" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.22.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.2.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Polly" Version="7.2.3" />
</ItemGroup>
Expand Down

0 comments on commit c915413

Please sign in to comment.