Skip to content

Commit 8842a50

Browse files
fiddlermikeydgaleyKeyfactorbhillkeyfactor
authored
Oktaauth (#10)
* Fix to allow dynamic oauth paths * Update generated README --------- Co-authored-by: Dave Galey <[email protected]> Co-authored-by: Keyfactor <[email protected]> Co-authored-by: Brian Hill <[email protected]>
1 parent b55a643 commit 8842a50

File tree

13 files changed

+620
-298
lines changed

13 files changed

+620
-298
lines changed

AWSOktaTester/Models/AuthResponse.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using Newtonsoft.Json;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Newtonsoft.Json;
216

317
namespace AWSOktaTester.Models
418
{

AWSOktaTester/Program.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using System;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System;
216
using System.Text;
317
using Amazon;
418
using Amazon.CertificateManager;

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
1.2.0
2+
* Added OTKA Auth Path to support Authentication Servers outside of the default server.
3+
4+
1.1.0
5+
* Added AWS IAM Authentication support with Roles
6+
7+
1.0.0
8+
* Convert to Universal Orchestrator Framework
9+
* Added OKTA Authentication Support

README.md

Lines changed: 139 additions & 130 deletions
Large diffs are not rendered by default.

aws-orchestrator-core/CustomFields.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
using System;
2-
using System.ComponentModel;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
314

15+
using System.ComponentModel;
416
using Newtonsoft.Json;
517

618
namespace Keyfactor.AnyAgent.AwsCertificateManager
@@ -25,6 +37,10 @@ public class OktaCustomFields : CustomFields
2537
[JsonProperty("scope")]
2638
[DefaultValue(false)]
2739
public string Scope { get; set; }
40+
41+
[JsonProperty("oauthpath")]
42+
[DefaultValue("/oauth2/default/v1/token")]
43+
public string OAuthPath { get; set; }
2844
}
2945

3046
public class IAMCustomFields : CustomFields

aws-orchestrator-core/Jobs/IAM/Inventory.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
using Amazon;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Amazon;
216
using Amazon.CertificateManager;
317
using Amazon.CertificateManager.Model;
418
using Amazon.Runtime.Internal.Util;
519
using Amazon.SecurityToken.Model;
6-
7-
using Keyfactor.AnyAgent.AwsCertificateManager.Models;
820
using Keyfactor.Logging;
921
using Keyfactor.Orchestrators.Common.Enums;
1022
using Keyfactor.Orchestrators.Extensions;
11-
1223
using Microsoft.Extensions.Logging;
13-
1424
using Newtonsoft.Json;
15-
16-
using RestSharp;
17-
1825
using System;
1926
using System.Collections.Generic;
2027
using System.Linq;

aws-orchestrator-core/Jobs/IAM/Management.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
using System;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System;
216
using System.IO;
317
using System.Linq;
418
using System.Net;
519
using System.Text;
6-
720
using Amazon;
821
using Amazon.CertificateManager;
922
using Amazon.CertificateManager.Model;
1023
using Amazon.Runtime.Internal.Util;
1124
using Amazon.SecurityToken.Model;
12-
13-
using Keyfactor.AnyAgent.AwsCertificateManager.Models;
1425
using Keyfactor.Logging;
1526
using Keyfactor.Orchestrators.Common.Enums;
1627
using Keyfactor.Orchestrators.Extensions;
17-
1828
using Microsoft.Extensions.Logging;
19-
2029
using Newtonsoft.Json;
21-
2230
using Org.BouncyCastle.Crypto;
2331
using Org.BouncyCastle.OpenSsl;
2432
using Org.BouncyCastle.Pkcs;
2533

26-
using RestSharp;
27-
2834
namespace Keyfactor.AnyAgent.AwsCertificateManager.Jobs.IAM
2935
{
3036
public class Management : IManagementJobExtension

aws-orchestrator-core/Jobs/Okta/Inventory.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
using Amazon;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Amazon;
216
using Amazon.CertificateManager;
317
using Amazon.CertificateManager.Model;
418
using Amazon.Runtime.Internal.Util;
519
using Amazon.SecurityToken.Model;
6-
720
using Keyfactor.AnyAgent.AwsCertificateManager.Models;
821
using Keyfactor.Logging;
922
using Keyfactor.Orchestrators.Common.Enums;
1023
using Keyfactor.Orchestrators.Extensions;
11-
1224
using Microsoft.Extensions.Logging;
13-
1425
using Newtonsoft.Json;
15-
1626
using RestSharp;
17-
1827
using System;
1928
using System.Collections.Generic;
2029
using System.Linq;
@@ -165,7 +174,7 @@ private AuthResponse OktaAuthenticate(InventoryJobConfiguration config)
165174
try
166175
{
167176
_logger.MethodEntry();
168-
var oktaAuthUrl = $"https://{config.CertificateStoreDetails.ClientMachine}/oauth2/default/v1/token";
177+
var oktaAuthUrl = $"https://{config.CertificateStoreDetails.ClientMachine}{CustomFields.OAuthPath}";
169178
_logger.LogTrace($"Custom Field List: {CustomFields}");
170179
_logger.LogTrace($"Okta Auth URL: {oktaAuthUrl}");
171180

aws-orchestrator-core/Jobs/Okta/Management.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
1-
using System;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System;
216
using System.IO;
317
using System.Linq;
418
using System.Net;
519
using System.Text;
6-
720
using Amazon;
821
using Amazon.CertificateManager;
922
using Amazon.CertificateManager.Model;
1023
using Amazon.Runtime.Internal.Util;
1124
using Amazon.SecurityToken.Model;
12-
1325
using Keyfactor.AnyAgent.AwsCertificateManager.Models;
1426
using Keyfactor.Logging;
1527
using Keyfactor.Orchestrators.Common.Enums;
1628
using Keyfactor.Orchestrators.Extensions;
17-
1829
using Microsoft.Extensions.Logging;
19-
2030
using Newtonsoft.Json;
21-
2231
using Org.BouncyCastle.Crypto;
2332
using Org.BouncyCastle.OpenSsl;
2433
using Org.BouncyCastle.Pkcs;
@@ -311,7 +320,7 @@ private AuthResponse OktaAuthenticate(ManagementJobConfiguration config)
311320
{
312321
_logger.MethodEntry();
313322

314-
var oktaAuthUrl = $"https://{config.CertificateStoreDetails.ClientMachine}/oauth2/default/v1/token";
323+
var oktaAuthUrl = $"https://{config.CertificateStoreDetails.ClientMachine}{CustomFields.OAuthPath}";
315324
_logger.LogTrace($"Custom Field List: {CustomFields}");
316325
_logger.LogTrace($"Okta Auth URL: {oktaAuthUrl}");
317326

aws-orchestrator-core/Models/AuthResponse.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using Newtonsoft.Json;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Newtonsoft.Json;
216

317
namespace Keyfactor.AnyAgent.AwsCertificateManager.Models
418
{

aws-orchestrator-core/Utilities.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
using System;
1+
// Copyright 2023 Keyfactor
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

15+
using System;
316
using Amazon;
417
using Amazon.Runtime;
518
using Amazon.Runtime.Internal.Util;

0 commit comments

Comments
 (0)