Skip to content

Commit 9fceec7

Browse files
OKTA-595075 password warn fix (#210)
### Features * Add IdxClientBuilder to simplify configuration of IdxClient. * Add PasswordWarnStateResolver to account for password warn state. * Add CustomPasswordWarnStateResolver enabling custom resolution of password warn state. ### Bug Fixes * Check password warn state on skip to prevent exception.
1 parent a30a78a commit 9fceec7

File tree

9 files changed

+1013
-3
lines changed

9 files changed

+1013
-3
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## 2.4.0
4+
5+
### Additions
6+
7+
* Add IdxClientBuilder to simplify configuration of IdxClient.
8+
* Add PasswordWarnStateResolver to account for password warn state.
9+
* Add CustomPasswordWarnStateResolver enabling custom resolution of password warn state.
10+
11+
### Bug Fixes
12+
13+
* Check password warn state on skip to prevent exception.
14+
315
## 2.3.2
416

517
### Bug Fixes
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using FluentAssertions;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Xunit;
8+
using Okta.Idx.Sdk.Configuration;
9+
10+
namespace Okta.Idx.Sdk.UnitTests
11+
{
12+
public class IdxClientBuilderShould
13+
{
14+
[Fact]
15+
public async Task UseConfiguration()
16+
{
17+
string testIssuer = "http://fake.com";
18+
string testClientId = Guid.NewGuid().ToString();
19+
string testRedirectUri = "http://fake.com/callback";
20+
IdxClient client = new IdxClientBuilder()
21+
.UseConfiguration(new IdxConfiguration
22+
{
23+
Issuer = testIssuer,
24+
ClientId = testClientId,
25+
RedirectUri = testRedirectUri
26+
})
27+
.Build();
28+
29+
client.Should().NotBeNull();
30+
client.Configuration.Issuer.Should().Be(testIssuer);
31+
client.Configuration.ClientId.Should().Be(testClientId);
32+
client.Configuration.RedirectUri.Should().Be(testRedirectUri);
33+
}
34+
35+
[Fact]
36+
public async Task BuildClient()
37+
{
38+
string testIssuer = "http://fake.com";
39+
string testClientId = Guid.NewGuid().ToString();
40+
string testRedirectUri = "http://fake.com/callback";
41+
IdxClient client = new IdxClientBuilder()
42+
.UseConfiguration(new IdxConfiguration
43+
{
44+
Issuer = testIssuer,
45+
ClientId = testClientId,
46+
RedirectUri = testRedirectUri
47+
})
48+
.Build();
49+
50+
client.Should().NotBeNull();
51+
client.PasswordWarnStateResolver.Should().NotBeNull();
52+
}
53+
54+
[Fact]
55+
public async Task UsePasswordWarnStateResolver()
56+
{
57+
string testIssuer = "http://fake.com";
58+
string testClientId = Guid.NewGuid().ToString();
59+
string testRedirectUri = "http://fake.com/callback";
60+
IdxClient client = new IdxClientBuilder()
61+
.UseConfiguration(new IdxConfiguration
62+
{
63+
Issuer = testIssuer,
64+
ClientId = testClientId,
65+
RedirectUri = testRedirectUri
66+
})
67+
.UsePasswordWarnStateResolver((idxResponse) => true)
68+
.Build();
69+
70+
client.Should().NotBeNull();
71+
client.PasswordWarnStateResolver.Should().NotBeNull();
72+
client.PasswordWarnStateResolver.GetType().Should().Be(typeof(CustomPasswordWarnStateResolver));
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)