Skip to content

Commit 6bf77eb

Browse files
Merge pull request #36 from okta/dev
Release 2.0.0.
2 parents c88ede6 + d8ed7e4 commit 6bf77eb

25 files changed

+268
-83
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: csharp
22
mono: latest
3-
# https://github.com/travis-ci/travis-ci/issues/9703
43
# .NET Core
5-
dotnet: 2.1.300
4+
dotnet: 3.1
65
script:
76
- ./build.sh

Okta.Auth.Sdk.IntegrationTests/Okta.Auth.Sdk.IntegrationTests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
1010
<PackageReference Include="FluentAssertions" Version="5.4.2" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
12-
<PackageReference Include="Okta.Sdk" Version="1.1.0" />
12+
<PackageReference Include="Okta.Sdk" Version="2.0.0" />
1313
<PackageReference Include="xunit" Version="2.3.1" />
1414
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
1515
</ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="FluentAssertions" Version="5.5.0" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
12-
<PackageReference Include="NSubstitute" Version="3.1.0" />
13-
<PackageReference Include="xunit" Version="2.3.1" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
10+
<PackageReference Include="FluentAssertions" Version="5.10.3" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
12+
<PackageReference Include="NSubstitute" Version="4.2.2" />
13+
<PackageReference Include="xunit" Version="2.4.0" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
15+
<PackageReference Include="coverlet.collector" Version="1.0.1" />
1516
</ItemGroup>
1617

1718
<ItemGroup>
1819
<ProjectReference Include="..\Okta.Auth.Sdk\Okta.Auth.Sdk.csproj" />
1920
<ProjectReference Include="..\Okta.Sdk.Abstractions\Okta.Sdk.Abstractions.csproj" />
2021
</ItemGroup>
2122

22-
<ItemGroup>
23-
<Reference Include="NSubstitute">
24-
<HintPath>..\..\..\Users\laura.rodriguez\.nuget\packages\nsubstitute\3.1.0\lib\netstandard1.3\NSubstitute.dll</HintPath>
25-
</Reference>
26-
</ItemGroup>
27-
2823
</Project>

Okta.Auth.Sdk.sln

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28010.2046
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29519.87
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Okta.Sdk.Abstractions", "Okta.Sdk.Abstractions\Okta.Sdk.Abstractions.csproj", "{55BBE5EC-6D9A-4B4E-888A-424DDAEFE4AA}"
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Okta.Sdk.Abstractions.UnitTests", "Okta.Sdk.Abstractions.UnitTests\Okta.Sdk.Abstractions.UnitTests.csproj", "{5222746D-BA58-4BAB-83F8-28321450784B}"
99
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Okta.Auth.Sdk.UnitTests", "Okta.Auth.Sdk.UnitTests\Okta.Auth.Sdk.UnitTests.csproj", "{69F3D20F-5C23-481A-9185-59CA51D7C91C}"
11-
EndProject
1210
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Okta.Auth.Sdk.IntegrationTests", "Okta.Auth.Sdk.IntegrationTests\Okta.Auth.Sdk.IntegrationTests.csproj", "{780E8F5A-0E85-4D2A-9AAA-19CD16FC86B8}"
1311
EndProject
1412
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Okta.Auth.Sdk", "Okta.Auth.Sdk\Okta.Auth.Sdk.csproj", "{C13343AA-549D-4D49-AC2F-239700469102}"
1513
EndProject
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Okta.Auth.Sdk.UnitTests", "Okta.Auth.Sdk.UnitTests\Okta.Auth.Sdk.UnitTests.csproj", "{42DEF79C-A773-4A03-9C37-E6DEDC7555B3}"
15+
EndProject
1616
Global
1717
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1818
Debug|Any CPU = Debug|Any CPU
@@ -27,10 +27,6 @@ Global
2727
{5222746D-BA58-4BAB-83F8-28321450784B}.Debug|Any CPU.Build.0 = Debug|Any CPU
2828
{5222746D-BA58-4BAB-83F8-28321450784B}.Release|Any CPU.ActiveCfg = Release|Any CPU
2929
{5222746D-BA58-4BAB-83F8-28321450784B}.Release|Any CPU.Build.0 = Release|Any CPU
30-
{69F3D20F-5C23-481A-9185-59CA51D7C91C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31-
{69F3D20F-5C23-481A-9185-59CA51D7C91C}.Debug|Any CPU.Build.0 = Debug|Any CPU
32-
{69F3D20F-5C23-481A-9185-59CA51D7C91C}.Release|Any CPU.ActiveCfg = Release|Any CPU
33-
{69F3D20F-5C23-481A-9185-59CA51D7C91C}.Release|Any CPU.Build.0 = Release|Any CPU
3430
{780E8F5A-0E85-4D2A-9AAA-19CD16FC86B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3531
{780E8F5A-0E85-4D2A-9AAA-19CD16FC86B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
3632
{780E8F5A-0E85-4D2A-9AAA-19CD16FC86B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -39,6 +35,10 @@ Global
3935
{C13343AA-549D-4D49-AC2F-239700469102}.Debug|Any CPU.Build.0 = Debug|Any CPU
4036
{C13343AA-549D-4D49-AC2F-239700469102}.Release|Any CPU.ActiveCfg = Release|Any CPU
4137
{C13343AA-549D-4D49-AC2F-239700469102}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{42DEF79C-A773-4A03-9C37-E6DEDC7555B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{42DEF79C-A773-4A03-9C37-E6DEDC7555B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{42DEF79C-A773-4A03-9C37-E6DEDC7555B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{42DEF79C-A773-4A03-9C37-E6DEDC7555B3}.Release|Any CPU.Build.0 = Release|Any CPU
4242
EndGlobalSection
4343
GlobalSection(SolutionProperties) = preSolution
4444
HideSolutionNode = FALSE

Okta.Auth.Sdk/AuthenticationClient.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected AuthenticationClient(IDataStore dataStore, OktaClientConfiguration con
7373
Context = new AuthenticationRequestContext()
7474
{
7575
DeviceToken = authenticateOptions.DeviceToken,
76-
}
76+
},
7777
};
7878

7979
var request = new HttpRequest
@@ -113,7 +113,6 @@ protected AuthenticationClient(IDataStore dataStore, OktaClientConfiguration con
113113
{
114114
Uri = "/api/v1/authn",
115115
Payload = authenticationRequest,
116-
117116
};
118117

119118
if (!string.IsNullOrEmpty(authenticateOptions.UserAgent))

Okta.Auth.Sdk/Okta.Auth.Sdk.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard1.3</TargetFramework>
5-
<Version>1.1.0</Version>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
5+
<Version>2.0.0</Version>
66
</PropertyGroup>
77

88
<PropertyGroup>
99
<Description>Official .NET SDK for the Okta Authentication API.</Description>
10-
<DocumentationFile>bin\$(Configuration)\netstandard1.3\Okta.Auth.Sdk.xml</DocumentationFile>
10+
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Okta.Auth.Sdk.xml</DocumentationFile>
1111
<RepositoryUrl>https://github.com/okta/okta-auth-dotnet</RepositoryUrl>
1212
<PackageProjectUrl>https://github.com/okta/okta-auth-dotnet</PackageProjectUrl>
1313
<PackageLicenseUrl>https://github.com/okta/okta-auth-dotnet/blob/master/LICENSE</PackageLicenseUrl>
@@ -17,7 +17,7 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
20+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2323
</PackageReference>

Okta.Sdk.Abstractions.UnitTests/Okta.Sdk.Abstractions.UnitTests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using FluentAssertions;
5+
using Xunit;
6+
7+
namespace Okta.Sdk.Abstractions.UnitTests
8+
{
9+
public class UserAgentHelperShould
10+
{
11+
[Theory]
12+
[InlineData("foo")]
13+
[InlineData("foo .NET")]
14+
[InlineData(".NET")]
15+
[InlineData(".NET foo")]
16+
[InlineData(".NET Framework 4.8")]
17+
public void ReturnPassedFrameworkDescriptionIfItDoesNotStartWithKeyword(string runtimeDescription)
18+
{
19+
// Keyword for runtimeDescription = ".NET Core"
20+
var frameworkInfo = UserAgentHelper.GetRuntimeVersion(runtimeDescription);
21+
22+
frameworkInfo.Should().Be(runtimeDescription);
23+
}
24+
25+
[Theory]
26+
[InlineData("file:///C:/Program Files/dotnet/shared/Microsoft.NETCore.App/2.0.9/System.Private.CoreLib.dll", "2.0.9")]
27+
[InlineData("Microsoft.NETCore.App/2.0.9/System.Private.CoreLib.dll", "2.0.9")]
28+
[InlineData("foo/Microsoft.NETCore.App/2.0.9/System.Private.CoreLib.dll", "2.0.9")]
29+
[InlineData("foo/Microsoft.NETCore.App/3.1.1/System.Private.CoreLib.dll", "3.1.1")]
30+
public void ReturnNormalizedFrameworkDescriptionWhenItStartsWithKeywordAndCodeBaseHasKeyword(string runtimeAssemblyCodeBase, string expectedVersion)
31+
{
32+
// Keyword for runtimeDescription = ".NET Core"
33+
// Keyword for codeBase = "Microsoft.NETCore.App"
34+
var frameworkInfo = UserAgentHelper.GetRuntimeVersion(".NET Core", runtimeAssemblyCodeBase);
35+
36+
frameworkInfo.Should().Be($".NET Core {expectedVersion}");
37+
}
38+
39+
[Theory]
40+
[InlineData("Microsoft.App/2.0.9/System.Private.CoreLib.dll")]
41+
[InlineData("foo/Microsoft.NETCore.foo/2.0.9/System.Private.CoreLib.dll")]
42+
[InlineData("foo/Microsoft.NETCore.Apps/3.1.1/System.Private.CoreLib.dll")]
43+
public void ReturnPassedFrameworkDescriptionWhenAssemblyCodeBaseDoesNotContainKeyword(string runtimeAssemblyCodeBase)
44+
{
45+
// Keyword for runtimeDescription = ".NET Core"
46+
// Keyword for codeBase = "Microsoft.NETCore.App"
47+
var frameworkInfo = UserAgentHelper.GetRuntimeVersion(".NET Core foo", runtimeAssemblyCodeBase);
48+
49+
frameworkInfo.Should().Be(".NET Core foo");
50+
}
51+
52+
[Fact]
53+
public void ReturnPassedFrameworkDescriptionWhenAssemblyCodeBaseContainsKeywordButNotVersion()
54+
{
55+
// Keyword for runtimeDescription = ".NET Core"
56+
// Keyword for codeBase = "Microsoft.NETCore.App"
57+
var frameworkInfo = UserAgentHelper.GetRuntimeVersion(".NET Core foo", "foo/Microsoft.NETCore.App");
58+
59+
frameworkInfo.Should().Be(".NET Core foo");
60+
}
61+
}
62+
}
63+

Okta.Sdk.Abstractions/AbstractResourceTypeResolver.cs

+6
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ namespace Okta.Sdk.Abstractions.Internal
1414
/// <typeparam name="T">The base type of resource to resolve.</typeparam>
1515
public abstract class AbstractResourceTypeResolver<T> : IResourceTypeResolver
1616
{
17+
/// <summary>
18+
/// The resource type resolver factory.
19+
/// </summary>
1720
protected AbstractResourceTypeResolverFactory _resourceTypeResolverFactory;
1821

22+
/// <summary>
23+
/// Gets or sets a resource type resolver factory.
24+
/// </summary>
1925
public abstract AbstractResourceTypeResolverFactory ResourceTypeResolverFactory
2026
{
2127
get;

Okta.Sdk.Abstractions/AbstractResourceTypeResolverFactory.cs

+30
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@
1111

1212
namespace Okta.Sdk.Abstractions
1313
{
14+
/// <summary>
15+
/// This class encapsulates the logic to resolve resource types.
16+
/// </summary>
1417
public class AbstractResourceTypeResolverFactory
1518
{
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="AbstractResourceTypeResolverFactory"/> class.
21+
/// </summary>
22+
/// <param name="resourceDefinedTypes">The resource types.</param>
1623
public AbstractResourceTypeResolverFactory(IEnumerable<TypeInfo> resourceDefinedTypes)
1724
{
1825
_resourceDefinedTypes = resourceDefinedTypes;
@@ -42,24 +49,47 @@ public AbstractResourceTypeResolverFactory(IEnumerable<TypeInfo> resourceDefined
4249
.ToArray();
4350
}
4451

52+
/// <summary>
53+
/// Gets all resource types.
54+
/// </summary>
55+
/// <returns>The enumeration of resource types. </returns>
4556
public IEnumerable<TypeInfo> GetAllResourceDefinedTypes()
4657
{
4758
return _resourceDefinedTypes;
4859
}
4960

61+
/// <summary>
62+
/// Gets all resolvers.
63+
/// </summary>
64+
/// <returns>The anumeration of resolvers.</returns>
5065
protected IEnumerable<(Type Resolver, Type For)> GetAllResolvers()
5166
{
5267
var resolvers = GetAllResolvers(GetAllResourceDefinedTypes());
5368

5469
return resolvers;
5570
}
5671

72+
/// <summary>
73+
/// Indicates if a resource type requires resolution.
74+
/// </summary>
75+
/// <param name="resourceType">The resource type.</param>
76+
/// <returns> A bool value indicating if the resource type requires resolution.</returns>
5777
public bool RequiresResolution(Type resourceType)
5878
=> GetResolver(resourceType) != null;
5979

80+
/// <summary>
81+
/// Creates a new resolver.
82+
/// </summary>
83+
/// <typeparam name="T">The resolver type.</typeparam>
84+
/// <returns>The resolver.</returns>
6085
public IResourceTypeResolver CreateResolver<T>()
6186
=> CreateResolver(forType: typeof(T));
6287

88+
/// <summary>
89+
/// Creates a new resolver for a given type.
90+
/// </summary>
91+
/// <param name="forType">The resource type.</param>
92+
/// <returns>The resolver.</returns>
6393
public IResourceTypeResolver CreateResolver(Type forType)
6494
{
6595
var concreteType = GetConcreteForInterface(forType);

Okta.Sdk.Abstractions/BaseOktaClient.cs

+15
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@
1717

1818
namespace Okta.Sdk.Abstractions
1919
{
20+
/// <summary>
21+
/// Base OktaClient implementation of <see cref="IOktaClient"/>.
22+
/// </summary>
2023
public class BaseOktaClient : IOktaClient
2124
{
25+
/// <summary>
26+
/// The <code>IDataStore</code> implementation to be used for making requests.
27+
/// </summary>
2228
protected IDataStore _dataStore;
29+
30+
/// <summary>
31+
/// The request context to be used when making requests.
32+
/// </summary>
2333
protected RequestContext _requestContext;
2434

2535
static BaseOktaClient()
@@ -87,6 +97,11 @@ protected BaseOktaClient(IDataStore dataStore, OktaClientConfiguration configura
8797
_requestContext = requestContext;
8898
}
8999

100+
/// <summary>
101+
/// Gets the Okta client configuration.
102+
/// </summary>
103+
/// <param name="apiClientConfiguration">The client configuration</param>
104+
/// <returns>An instance of <c>OktaClientConfiguration</c></returns>
90105
protected static OktaClientConfiguration GetConfigurationOrDefault(OktaClientConfiguration apiClientConfiguration = null)
91106
{
92107
string configurationFileRoot = Directory.GetCurrentDirectory();

Okta.Sdk.Abstractions/BaseResource.cs

+14
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@
1212

1313
namespace Okta.Sdk.Abstractions
1414
{
15+
/// <summary>
16+
/// Base resource implementation for <see cref="IResource"/>.
17+
/// </summary>
1518
public class BaseResource : IResource
1619
{
1720
internal static readonly TypeInfo ResourceTypeInfo = typeof(IResource).GetTypeInfo();
1821

22+
/// <summary>
23+
/// The Okta client.
24+
/// </summary>
1925
protected IOktaClient _client;
26+
2027
private ResourceFactory _resourceFactory;
2128
private ILogger _logger;
2229
private IDictionary<string, object> _data;
@@ -29,6 +36,13 @@ public BaseResource()
2936
Initialize(null, null, null, null);
3037
}
3138

39+
/// <summary>
40+
/// Initializes a resource.
41+
/// </summary>
42+
/// <param name="client">The Okta client.</param>
43+
/// <param name="resourceFactory">The resource factory.</param>
44+
/// <param name="data">The resource data.</param>
45+
/// <param name="logger">The logger.</param>
3246
public void Initialize(
3347
IOktaClient client,
3448
ResourceFactory resourceFactory,

0 commit comments

Comments
 (0)