Skip to content

Commit

Permalink
Update spec to 2.7.1 (#504)
Browse files Browse the repository at this point in the history
* Update README.md
* Pull 2.6.0 changes and regenerate.
* Regenerate code with spec 2.7.0.
* Add ITs for Orgs API.
* Add support for GroupSchema operations.
* Add ITs for authenticators and GroupSchema.
* Regenerate code using spec 2.7.1.
* Add UTs to cover authenticators API.
* Add missing header.
* Remove gh-pages deployment
* Skipping GroupSchema/UserSchema update property ITs which depend on OKTA-431664.
* Skipping CreateOktaSignOnRadiusPolicyRule IT which depends on OKTA-431665.
* Add sleep to wait for job in RemoveROle test.
* Skip temporarily GroupSchemaScenarios.UpdatePropertyToGroupSchemaAsync.

Co-authored-by: Andrii Zhegurov <[email protected]>
  • Loading branch information
laura-rodriguez and andriizhegurov-okta authored Sep 27, 2021
1 parent 4399429 commit 9913188
Show file tree
Hide file tree
Showing 58 changed files with 2,599 additions and 57 deletions.
19 changes: 0 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,6 @@ script:
- if [[ $DEPLOY_DOCS = true && ($TRAVIS_PULL_REQUEST = false && $TRAVIS_BRANCH = master || "$TRAVIS_TAG" != "") ]]; then
./build.sh --target Docs;
fi
deploy:
- provider: pages
skip_cleanup: true
github_token: "$GITHUB_TOKEN"
local_dir: docs/temp
email: [email protected]
name: ".NET Deployment Bot"
on:
condition: "$DEPLOY_DOCS = true"
tags: true
- provider: pages
skip_cleanup: true
github_token: "$GITHUB_TOKEN"
local_dir: docs/temp
email: [email protected]
name: ".NET Deployment Bot"
on:
condition: "$DEPLOY_DOCS = true && $TRAVIS_PULL_REQUEST = false"
branch: master
notifications:
slack:
if: type = cron
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ Running changelog of releases since `3.1.1`
* [Zones API's endpoints](https://developer.okta.com/docs/reference/api/zones/)
* [Mappings API's endpoints](https://developer.okta.com/docs/reference/api/mappings/)
* [ThreatInsight configuration API's endpoints](https://developer.okta.com/docs/reference/api/threat-insight/)
- Add an overload for `GroupsClient.DeleteGroupRuleAsync` function. Now you can specify `removeUsers` parameter indicating whether to keep or remove users from groups assigned by this rule.
* [Authenticators API's endpoints](https://developer.okta.com/docs/reference/api/authenticators-admin/)
* [Org API's endpoints](https://developer.okta.com/docs/reference/api/org/)
* [GroupSchema API's endpoints](https://developer.okta.com/docs/reference/api/schemas/#group-schema-operations)
- Add an overload for `GroupsClient.DeleteGroupRuleAsync` method. Now you can specify `removeUsers` parameter indicating whether to keep or remove users from groups assigned by this rule.


### Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions openapi/errata.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const modelErrata = [
{ path: 'CSRMetadataSubject', rename: 'CsrMetadataSubject', renameReason: 'Pattern consistency' },
{ path: 'CSRMetadataSubjectAltNames', rename: 'CsrMetadataSubjectAltNames', renameReason: 'Pattern consistency' },
{ path: 'UserSchema', includeNullValues: true },
{ path: 'GroupSchema', includeNullValues: true },
];

const operationErrata = [
Expand Down
93 changes: 59 additions & 34 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.3.0",
"@okta/openapi": "^2.7.1",
"json-stable-stringify": "^1.0.1",
"lodash": "^4.17.21"
}
Expand Down
47 changes: 47 additions & 0 deletions src/Okta.Sdk.IntegrationTests/AuthenticatorScenarios.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// <copyright file="AuthenticatorScenarios.cs" company="Okta, Inc">
// Copyright (c) 2020 - 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>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
using FluentAssertions.Extensions;
using Xunit;

namespace Okta.Sdk.IntegrationTests
{
public class AuthenticatorScenarios
{
[Fact]
public async Task ListAuthenticatorsAsync()
{
var client = TestClient.Create();

var authenticators = await client.Authenticators.ListAuthenticators().ToListAsync();

authenticators.Should().NotBeNullOrEmpty();
authenticators.Select(x => x.Type.ToString()).Should().BeSubsetOf(new List<string> { "app", "password", "security_question", "phone", "email", "security_key" });
}

[Fact]
public async Task GetAuthenticatorByIdAsync()
{
var client = TestClient.Create();

var authenticators = await client.Authenticators.ListAuthenticators().ToListAsync();
// Password should be enabled
var passwordAuthenticator = authenticators.FirstOrDefault(x => x.Type == AuthenticatorType.Password);

var retrievedAuthenticator = await client.Authenticators.GetAuthenticatorAsync(passwordAuthenticator.Id);

retrievedAuthenticator.Key.Should().Be(passwordAuthenticator.Key);
retrievedAuthenticator.Name.Should().Be(passwordAuthenticator.Name);
retrievedAuthenticator.Status.Should().Be(passwordAuthenticator.Status);
retrievedAuthenticator.Created.Should().Be(passwordAuthenticator.Created);
retrievedAuthenticator.Settings.Should().Be(passwordAuthenticator.Settings);
}
}
}
79 changes: 79 additions & 0 deletions src/Okta.Sdk.IntegrationTests/GroupSchemaScenarios.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// <copyright file="GroupSchemaScenarios.cs" company="Okta, Inc">
// Copyright (c) 2020 - 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>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;

namespace Okta.Sdk.IntegrationTests
{
public class GroupSchemaScenarios
{
[Fact]
public async Task GetGroupSchemaAsync()
{
var client = TestClient.Create();

var groupSchema = await client.GroupSchemas.GetGroupSchemaAsync();
groupSchema.Should().NotBeNull();
groupSchema.Schema.Should().Be("http://json-schema.org/draft-04/schema#");
groupSchema.Definitions?.Base?.Id.Should().Be("#base");
groupSchema.Definitions?.Custom?.Id.Should().Be("#custom");
groupSchema.Name.Should().Be("group");
}

[Fact(Skip = "Depends on OKTA-431664")]
public async Task UpdatePropertyToGroupSchemaAsync()
{
var client = TestClient.Create();

var groupSchema = await client.GroupSchemas.GetGroupSchemaAsync();
var guid = Guid.NewGuid();

// Add custom attribute
var customAttributeDetails = new GroupSchemaAttribute()
{
Title = "Group administrative contact",
Type = "string",
Description = guid.ToString(),
MinLength = 1,
MaxLength = 20,
Permissions = new List<IUserSchemaAttributePermission>
{
new UserSchemaAttributePermission
{
Action = "READ_WRITE",
Principal = "SELF",
},
},
};

var customAttribute = new Resource();
customAttribute["groupContact"] = customAttributeDetails;
groupSchema.Definitions.Custom.Properties = customAttribute;

var updatedGroupSchema = await client.GroupSchemas.UpdateGroupSchemaAsync(groupSchema);

var retrievedCustomAttribute = updatedGroupSchema.Definitions.Custom.Properties.GetProperty<GroupSchemaAttribute>("groupContact");
retrievedCustomAttribute.Title.Should().Be("Group administrative contact");
retrievedCustomAttribute.Type.Should().Be(UserSchemaAttributeType.String);
retrievedCustomAttribute.Description.Should().Be(guid.ToString());
retrievedCustomAttribute.Required.Should().BeNull();
retrievedCustomAttribute.MinLength.Should().Be(1);
retrievedCustomAttribute.MaxLength.Should().Be(20);
retrievedCustomAttribute.Permissions.FirstOrDefault().Principal.Should().Be("SELF");
retrievedCustomAttribute.Permissions.FirstOrDefault().Action.Should().Be("READ_WRITE");

// Remove custom attribute
customAttribute["groupContact"] = null;
updatedGroupSchema.Definitions.Custom.Properties = customAttribute;
updatedGroupSchema = await client.GroupSchemas.UpdateGroupSchemaAsync(updatedGroupSchema);
updatedGroupSchema.Definitions.Custom.Properties.GetProperty<UserSchemaAttribute>("groupContact").Should().BeNull();
}
}
}
Loading

0 comments on commit 9913188

Please sign in to comment.