Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Generic OIDC accounts #897

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,13 @@ Octopus.Client.Editors
Octopus.Client.Editors.EnvironmentEditor Customize(Action<EnvironmentResource>)
Octopus.Client.Editors.EnvironmentEditor Save()
}
class GenericOidcAccountEditor
Octopus.Client.Editors.IResourceEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
Octopus.Client.Editors.IResourceBuilder
Octopus.Client.Editors.AccountEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
{
.ctor(Octopus.Client.Repositories.IAccountRepository)
}
interface IResourceBuilder
{
}
Expand Down Expand Up @@ -1178,6 +1185,13 @@ Octopus.Client.Editors.Async
Octopus.Client.Editors.Async.EnvironmentEditor Customize(Action<EnvironmentResource>)
Task<EnvironmentEditor> Save()
}
class GenericOidcAccountEditor
Octopus.Client.Editors.Async.IResourceEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
Octopus.Client.Editors.Async.IResourceBuilder
Octopus.Client.Editors.Async.AccountEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
{
.ctor(Octopus.Client.Repositories.Async.IAccountRepository)
}
interface IResourceBuilder
{
}
Expand Down Expand Up @@ -6025,6 +6039,7 @@ Octopus.Client.Model
AzureAccount = 4
WorkerPool = 5
UsernamePasswordAccount = 6
GenericOidcAccount = 7
}
class VersioningStrategyResource
{
Expand Down Expand Up @@ -6125,6 +6140,7 @@ Octopus.Client.Model.Accounts
Token = 7
GoogleCloudAccount = 8
AzureOidc = 9
GenericOidcAccount = 10
}
class AmazonWebServicesAccountResource
Octopus.Client.Extensibility.IResource
Expand Down Expand Up @@ -6258,6 +6274,19 @@ Octopus.Client.Model.Accounts
String Site { get; set; }
}
}
class GenericOidcAccountResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Extensibility.INamedResource
Octopus.Client.Extensibility.IHaveSpaceResource
Octopus.Client.Model.IHaveSlugResource
Octopus.Client.Model.Accounts.AccountResource
{
.ctor()
Octopus.Client.Model.Accounts.AccountType AccountType { get; }
String Audience { get; set; }
String[] DeploymentSubjectKeys { get; set; }
}
class GoogleCloudAccountResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,13 @@ Octopus.Client.Editors
Octopus.Client.Editors.EnvironmentEditor Customize(Action<EnvironmentResource>)
Octopus.Client.Editors.EnvironmentEditor Save()
}
class GenericOidcAccountEditor
Octopus.Client.Editors.IResourceEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
Octopus.Client.Editors.IResourceBuilder
Octopus.Client.Editors.AccountEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
{
.ctor(Octopus.Client.Repositories.IAccountRepository)
}
interface IResourceBuilder
{
}
Expand Down Expand Up @@ -1179,6 +1186,13 @@ Octopus.Client.Editors.Async
Octopus.Client.Editors.Async.EnvironmentEditor Customize(Action<EnvironmentResource>)
Task<EnvironmentEditor> Save()
}
class GenericOidcAccountEditor
Octopus.Client.Editors.Async.IResourceEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
Octopus.Client.Editors.Async.IResourceBuilder
Octopus.Client.Editors.Async.AccountEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
{
.ctor(Octopus.Client.Repositories.Async.IAccountRepository)
}
interface IResourceBuilder
{
}
Expand Down Expand Up @@ -6048,6 +6062,7 @@ Octopus.Client.Model
AzureAccount = 4
WorkerPool = 5
UsernamePasswordAccount = 6
GenericOidcAccount = 7
}
class VersioningStrategyResource
{
Expand Down Expand Up @@ -6148,6 +6163,7 @@ Octopus.Client.Model.Accounts
Token = 7
GoogleCloudAccount = 8
AzureOidc = 9
GenericOidcAccount = 10
}
class AmazonWebServicesAccountResource
Octopus.Client.Extensibility.IResource
Expand Down Expand Up @@ -6281,6 +6297,19 @@ Octopus.Client.Model.Accounts
String Site { get; set; }
}
}
class GenericOidcAccountResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Extensibility.INamedResource
Octopus.Client.Extensibility.IHaveSpaceResource
Octopus.Client.Model.IHaveSlugResource
Octopus.Client.Model.Accounts.AccountResource
{
.ctor()
Octopus.Client.Model.Accounts.AccountType AccountType { get; }
String Audience { get; set; }
String[] DeploymentSubjectKeys { get; set; }
}
class GoogleCloudAccountResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Octopus.Client.Model.Accounts;
using Octopus.Client.Repositories.Async;

namespace Octopus.Client.Editors.Async
{
public class GenericOidcAccountEditor : AccountEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
{
public GenericOidcAccountEditor(IAccountRepository repository) : base(repository)
{
}
}
}
12 changes: 12 additions & 0 deletions source/Octopus.Server.Client/Editors/GenericOidcAccountEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Octopus.Client.Model.Accounts;
using Octopus.Client.Repositories;

namespace Octopus.Client.Editors
{
public class GenericOidcAccountEditor : AccountEditor<GenericOidcAccountResource, GenericOidcAccountEditor>
{
public GenericOidcAccountEditor(IAccountRepository repository) : base(repository)
{
}
}
}
2 changes: 2 additions & 0 deletions source/Octopus.Server.Client/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public static AccountType DetermineAccountType(this Type type)
accountType = AccountType.Token;
else if (type == typeof(GoogleCloudAccountResource))
accountType = AccountType.GoogleCloudAccount;
else if (type == typeof(GenericOidcAccountResource))
accountType = AccountType.GenericOidcAccount;
else
throw new ArgumentException($"Account type {type} is not supported");

Expand Down
1 change: 1 addition & 0 deletions source/Octopus.Server.Client/Model/Accounts/AccountType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public enum AccountType
Token,
GoogleCloudAccount,
AzureOidc,
GenericOidcAccount,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;
using Octopus.Client.Extensibility.Attributes;

namespace Octopus.Client.Model.Accounts
{
public class GenericOidcAccountResource : AccountResource
{
public override AccountType AccountType => AccountType.GenericOidcAccount;

[Trim]
[Writeable]
public string Audience { get; set; }

[Writeable]
public string[] DeploymentSubjectKeys { get; set; }
}
}
3 changes: 2 additions & 1 deletion source/Octopus.Server.Client/Model/VariableType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum VariableType
AmazonWebServicesAccount,
AzureAccount,
WorkerPool,
UsernamePasswordAccount
UsernamePasswordAccount,
GenericOidcAccount
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class AccountConverter : InheritedClassConverter<AccountResource, Account
{AccountType.SshKeyPair, typeof(SshKeyPairAccountResource)},
{AccountType.AmazonWebServicesAccount, typeof(AmazonWebServicesAccountResource)},
{AccountType.Token, typeof(TokenAccountResource)},
{AccountType.GoogleCloudAccount, typeof(GoogleCloudAccountResource)}
{AccountType.GoogleCloudAccount, typeof(GoogleCloudAccountResource)},
{AccountType.GenericOidcAccount, typeof(GenericOidcAccountResource)}
};

protected override IDictionary<AccountType, Type> DerivedTypeMappings => AccountTypeMappings;
Expand Down
Loading