Skip to content

Commit

Permalink
Update openapi spec to 2.12.0. (#543)
Browse files Browse the repository at this point in the history
* Update openapi spec to 2.12.0.
* Skip a few brands ITs until OKTA-491199 is fixed.
  • Loading branch information
laura-rodriguez authored Apr 20, 2022
1 parent 3931abc commit 1043bc1
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 27 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog
Running changelog of releases since `3.1.1`

## 5.6.0

- Update Open API spec to 2.12.0
- Add `Application.UpdateApplicationPolicyAsync` method
- Add `APPLE` as a `LogCredentialProvider` option
- Add support for `AllowedOktaApps` in Scopes
- Add `IframeEmbed` as a `ScopeType` option

## v5.5.0

- Add support for [Email template operations](https://developer.okta.com/docs/reference/api/brands/#email-template-operations).
Expand Down
32 changes: 16 additions & 16 deletions openapi/package-lock.json

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

2 changes: 1 addition & 1 deletion openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"homepage": "https://github.com/okta/oktasdk-sdk-dotnet#readme",
"devDependencies": {
"@okta/openapi": "^2.10.0",
"@okta/openapi": "^2.12.0",
"json-stable-stringify": "^1.0.1",
"lodash": "^4.17.21"
}
Expand Down
18 changes: 9 additions & 9 deletions src/Okta.Sdk.IntegrationTests/BrandScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ public async Task ListEmailTemplateCustomizations()
emailTemplateCustomizations.Should().NotBeNull();
}

[Fact]
public async Task CreateEmailTemplateCustomaization()
[Fact(Skip = "Skip until OKTA-491199 is fixed")]
public async Task CreateEmailTemplateCustomization()
{
var client = TestClient.Create();
var brand = await client.Brands.ListBrands().FirstOrDefaultAsync();
var emailTemplate = await client.Brands.ListEmailTemplates(brand.Id).FirstOrDefaultAsync();
var testBody = $"Test Customization - {nameof(CreateEmailTemplateCustomaization)}" + "${activationLink} ${activationToken}";
var testSubject = $"Test Subject - {nameof(CreateEmailTemplateCustomaization)}";
var testBody = $"\"<!DOCTYPE html><html>...${{activationLink}}...</html>\"";
var testSubject = $"Test Subject - {nameof(CreateEmailTemplateCustomization)}";
var testLanguage = "fr";

var emailTemplateCustomizationRequest = new EmailTemplateCustomizationRequest()
Expand Down Expand Up @@ -220,7 +220,7 @@ public async Task CreateEmailTemplateCustomaization()
}
}

[Fact]
[Fact(Skip = "Skip until OKTA-491199 is fixed")]
public async Task DeleteEmailTemplateCustomization()
{
var client = TestClient.Create();
Expand Down Expand Up @@ -259,7 +259,7 @@ public async Task DeleteEmailTemplateCustomization()
exceptionWasThrown.Should().BeTrue();
}

[Fact]
[Fact(Skip = "Skip until OKTA-491199 is fixed")]
public async Task GetEmailTemplateCustomization()
{
var client = TestClient.Create();
Expand Down Expand Up @@ -300,7 +300,7 @@ public async Task GetEmailTemplateCustomization()
}
}

[Fact]
[Fact(Skip = "Skip until OKTA-491199 is fixed")]
public async Task UpdateEmailTemplateCustomization()
{
var client = TestClient.Create();
Expand Down Expand Up @@ -354,7 +354,7 @@ public async Task UpdateEmailTemplateCustomization()
}
}

[Fact]
[Fact(Skip = "Skip until OKTA-491199 is fixed")]
public async Task GetEmailTemplateCustomizationPreview()
{
var client = TestClient.Create();
Expand Down Expand Up @@ -396,7 +396,7 @@ public async Task GetEmailTemplateDefaultContent()
emailTemplateCustomizationContent.Should().NotBeNull();
}

[Fact]
[Fact(Skip = "Skip until OKTA-491199 is fixed")]
public async Task GetEmailTemplateDefaultContentPreview()
{
var client = TestClient.Create();
Expand Down
76 changes: 76 additions & 0 deletions src/Okta.Sdk.IntegrationTests/PoliciesScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,82 @@ public async Task CreateAccessPolicyPolicyRule()
}
}

[Fact]
public async Task AssignApplicationToPolicy()
{
var client = TestClient.Create();
var guid = Guid.NewGuid();

var createdApp = await client.Applications.CreateApplicationAsync(new CreateOpenIdConnectApplication
{
Label = $"dotnet-sdk: AddOpenIdConnectApp {guid}",
ClientUri = "https://example.com/client",
LogoUri = "https://example.com/assets/images/logo-new.png",
ResponseTypes = new List<OAuthResponseType>
{
OAuthResponseType.Token,
OAuthResponseType.IdToken,
OAuthResponseType.Code,
},
RedirectUris = new List<string>
{
"https://example.com/oauth2/callback",
"myapp://callback",
},
PostLogoutRedirectUris = new List<string>
{
"https://example.com/postlogout",
"myapp://postlogoutcallback",
},
GrantTypes = new List<OAuthGrantType>
{
OAuthGrantType.Implicit,
OAuthGrantType.AuthorizationCode,
},
ApplicationType = OpenIdConnectApplicationType.Web,
});

var policy1 = new Policy()
{
// Name has a maximum of 50 chars
Name = $"dotnet-sdk: AccessPolicy {Guid.NewGuid()}".Substring(0, 50),
Type = PolicyType.AccessPolicy,
Status = "ACTIVE",
Description = "The default policy applies in all situations if no other policy applies.",
};

var createdPolicy1 = await client.Policies.CreatePolicyAsync(policy1);

var policy2 = new Policy()
{
// Name has a maximum of 50 chars
Name = $"dotnet-sdk: AccessPolicy {Guid.NewGuid()}".Substring(0, 50),
Type = PolicyType.AccessPolicy,
Status = "ACTIVE",
Description = "The default policy applies in all situations if no other policy applies.",
};

var createdPolicy2 = await client.Policies.CreatePolicyAsync(policy2);

try
{
await createdApp.UpdateApplicationPolicyAsync(createdPolicy1.Id);
var updatedApp = await client.Applications.GetApplicationAsync(createdApp.Id);
updatedApp.GetAccessPolicyId().Should().Be(createdPolicy1.Id);

await createdApp.UpdateApplicationPolicyAsync(createdPolicy2.Id);
updatedApp = await client.Applications.GetApplicationAsync(createdApp.Id);
updatedApp.GetAccessPolicyId().Should().Be(createdPolicy2.Id);
}
finally
{
await client.Applications.DeactivateApplicationAsync(createdApp.Id);
await client.Applications.DeleteApplicationAsync(createdApp.Id);
await client.Policies.DeletePolicyAsync(createdPolicy1.Id);
await client.Policies.DeletePolicyAsync(createdPolicy2.Id);
}
}

[Fact]
public async Task CreateProfileEnrollmentPolicyRule()
{
Expand Down
5 changes: 5 additions & 0 deletions src/Okta.Sdk/Generated/Application.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,10 @@ public Task<IApplicationFeature> UpdateFeatureForApplicationAsync(ICapabilitiesO
string name, CancellationToken cancellationToken = default(CancellationToken))
=> GetClient().Applications.UpdateFeatureForApplicationAsync(capabilities, Id, name, cancellationToken);

/// <inheritdoc />
public Task UpdateApplicationPolicyAsync(
string policyId, CancellationToken cancellationToken = default(CancellationToken))
=> GetClient().Applications.UpdateApplicationPolicyAsync(Id, policyId, cancellationToken);

}
}
14 changes: 14 additions & 0 deletions src/Okta.Sdk/Generated/ApplicationsClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,20 @@ public ICollectionClient<IApplicationGroupAssignment> ListApplicationGroupAssign
},
}, cancellationToken).ConfigureAwait(false);

/// <inheritdoc />
public async Task UpdateApplicationPolicyAsync(string appId, string policyId, CancellationToken cancellationToken = default(CancellationToken))
=> await PutAsync(new HttpRequest
{
Uri = "/api/v1/apps/{appId}/policies/{policyId}",
Verb = HttpVerb.Put,

PathParameters = new Dictionary<string, object>()
{
["appId"] = appId,
["policyId"] = policyId,
},
}, cancellationToken).ConfigureAwait(false);

/// <inheritdoc />
public async Task RevokeOAuth2TokensForApplicationAsync(string appId, CancellationToken cancellationToken = default(CancellationToken))
=> await DeleteAsync(new HttpRequest
Expand Down
3 changes: 3 additions & 0 deletions src/Okta.Sdk/Generated/FactorProvider.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public sealed class FactorProvider : StringEnum
/// <summary>The CUSTOM FactorProvider.</summary>
public static FactorProvider Custom = new FactorProvider("CUSTOM");

/// <summary>The APPLE FactorProvider.</summary>
public static FactorProvider Apple = new FactorProvider("APPLE");

/// <summary>
/// Implicit operator declaration to accept and convert a string value as a <see cref="FactorProvider"/>
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Okta.Sdk/Generated/IApplication.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,8 @@ Task<IApplicationFeature> GetFeatureForApplicationAsync(
Task<IApplicationFeature> UpdateFeatureForApplicationAsync(ICapabilitiesObject capabilities,
string name, CancellationToken cancellationToken = default(CancellationToken));

Task UpdateApplicationPolicyAsync(
string policyId, CancellationToken cancellationToken = default(CancellationToken));

}
}
9 changes: 9 additions & 0 deletions src/Okta.Sdk/Generated/IApplicationsClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ public partial interface IApplicationsClient
/// <returns>A Task that represents the asynchronous operation.</returns>
Task UploadApplicationLogoAsync(string appId, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Assign an application to a specific policy. This unassigns the application from its currently assigned policy.
/// </summary>
/// <param name="appId"></param>
/// <param name="policyId"></param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A Task that represents the asynchronous operation.</returns>
Task UpdateApplicationPolicyAsync(string appId, string policyId, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Revokes all tokens for the specified application
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ public partial interface IIdentityProviderCredentialsSigning : IResource
{
string Kid { get; set; }

string PrivateKey { get; set; }

string TeamId { get; set; }

}
}
2 changes: 2 additions & 0 deletions src/Okta.Sdk/Generated/IScope.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Okta.Sdk
/// <summary>Represents a Scope resource in the Okta API.</summary>
public partial interface IScope : IResource
{
IList<IframeEmbedScopeAllowedApps> AllowedOktaApps { get; set; }

string StringValue { get; set; }

ScopeType Type { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,19 @@ public string Kid
set => this["kid"] = value;
}

/// <inheritdoc/>
public string PrivateKey
{
get => GetStringProperty("privateKey");
set => this["privateKey"] = value;
}

/// <inheritdoc/>
public string TeamId
{
get => GetStringProperty("teamId");
set => this["teamId"] = value;
}

}
}
34 changes: 34 additions & 0 deletions src/Okta.Sdk/Generated/IframeEmbedScopeAllowedApps.Generated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// <copyright file="IframeEmbedScopeAllowedApps.Generated.cs" company="Okta, Inc">
// Copyright (c) 2014 - present Okta, Inc. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
// </copyright>

// This file was automatically generated. Don't modify it directly.

namespace Okta.Sdk
{
/// <summary>
/// An enumeration of IframeEmbedScopeAllowedApps values in the Okta API.
/// </summary>
public sealed class IframeEmbedScopeAllowedApps : StringEnum
{
/// <summary>The OKTA_ENDUSER IframeEmbedScopeAllowedApps.</summary>
public static IframeEmbedScopeAllowedApps OktaEnduser = new IframeEmbedScopeAllowedApps("OKTA_ENDUSER");

/// <summary>
/// Implicit operator declaration to accept and convert a string value as a <see cref="IframeEmbedScopeAllowedApps"/>
/// </summary>
/// <param name="value">The value to use</param>
public static implicit operator IframeEmbedScopeAllowedApps(string value) => new IframeEmbedScopeAllowedApps(value);

/// <summary>
/// Creates a new <see cref="IframeEmbedScopeAllowedApps"/> instance.
/// </summary>
/// <param name="value">The value to use.</param>
public IframeEmbedScopeAllowedApps(string value)
: base(value)
{
}

}
}
3 changes: 3 additions & 0 deletions src/Okta.Sdk/Generated/LogCredentialProvider.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public sealed class LogCredentialProvider : StringEnum
/// <summary>The YUBIKEY LogCredentialProvider.</summary>
public static LogCredentialProvider Yubikey = new LogCredentialProvider("YUBIKEY");

/// <summary>The APPLE LogCredentialProvider.</summary>
public static LogCredentialProvider Apple = new LogCredentialProvider("APPLE");

/// <summary>
/// Implicit operator declaration to accept and convert a string value as a <see cref="LogCredentialProvider"/>
/// </summary>
Expand Down
Loading

0 comments on commit 1043bc1

Please sign in to comment.