This repository was archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Change from package to local references #89
Open
tothegills
wants to merge
14
commits into
main
Choose a base branch
from
tothegills/localReferences
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dca786f
Added ability for AzureAD to follow the Microsoft Graph API for Group…
StephenShamakian 85a97d1
Merge pull request #1 from OctopusDeploy/main
StephenShamakian 469c3cd
Cleaned up warnings messages and potential null references.
StephenShamakian 9e507f8
- Added Feature flag based on ClientKey value
StephenShamakian 60709d1
Documentation
StephenShamakian b31fbc3
Removed OctopusServer Service Stop/Start from install script
StephenShamakian 89c55b3
Fixing typos in readme.md
StephenShamakian 37cabba
Fixed some potential NullException errors if certain claim tokens arn…
StephenShamakian b0d237b
Merge pull request #2 from OctopusDeploy/main
StephenShamakian b0ebce7
Merge branch 'OctopusDeploy:main' into main
StephenShamakian 4f5d67e
Merge from main
tothegills fef865f
Change from package to local references
tothegills f313794
Update AzureAD extension to reflect base change
tothegills 3a72771
Add AzureAD configuration maps
tothegills File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Run this script after installing a new version of Octopus Server, but before starting it (due to file lock and dependency load issues). | ||
|
|
||
| $OctopusServerBinaryLocation = "E:\Program Files\Octopus Deploy\Octopus" # Make sure this points to where you install the Octopus Server binaries | ||
| $OctopusServerCustomExtensionsLocation = "C:\ProgramData\Octopus\CustomExtensions\" # This should always point to where the Octopus Server CustomExtenions folder lives | ||
|
|
||
| Copy-Item "$OctopusServerBinaryLocation\Octopus.Data.dll" -Destination "$OctopusServerCustomExtensionsLocation" -Force | ||
| Copy-Item "$OctopusServerBinaryLocation\Octopus.Server.Extensibility.Authentication.dll" -Destination "$OctopusServerCustomExtensionsLocation" -Force | ||
| Copy-Item "$OctopusServerBinaryLocation\BuiltInExtensions\Octopus.Server.Extensibility.Authentication.OpenIDConnect.Common.dll" -Destination "$OctopusServerCustomExtensionsLocation" -Force | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,13 +15,13 @@ | |
| <PackageProjectUrl>https://github.com/OctopusDeploy/OpenIDConnectAuthenticationProviders</PackageProjectUrl> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Octopus.Server.Client" Version="11.2.3319" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" /> | ||
| <None Include="..\..\build\icon.png" Pack="true" PackagePath="" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Reference Include="Octopus.Server.Client"> | ||
| <HintPath>C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.Client.dll</HintPath> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| </Reference> | ||
| </ItemGroup> | ||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using Octopus.Server.Extensibility.Authentication.OpenIDConnect.Common.Configuration; | ||
| using Octopus.Data.Model; | ||
| using Octopus.Server.Extensibility.Authentication.OpenIDConnect.Common.Configuration; | ||
|
|
||
| namespace Octopus.Server.Extensibility.Authentication.AzureAD.Configuration | ||
| { | ||
|
|
@@ -10,5 +11,7 @@ public AzureADConfiguration() : base(AzureADConfigurationStore.SingletonId, "Azu | |
| { | ||
| RoleClaimType = DefaultRoleClaimType; | ||
| } | ||
|
|
||
| public SensitiveString? ClientKey { get; set; } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how these changes relate to the PR? |
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 16 additions & 2 deletions
18
source/Server.AzureAD/Configuration/AzureADConfigurationStore.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,33 @@ | ||
| using Octopus.Data.Storage.Configuration; | ||
| using Octopus.Data.Model; | ||
| using Octopus.Data.Storage.Configuration; | ||
| using Octopus.Diagnostics; | ||
| using Octopus.Server.Extensibility.Authentication.OpenIDConnect.Common.Configuration; | ||
|
|
||
| namespace Octopus.Server.Extensibility.Authentication.AzureAD.Configuration | ||
| { | ||
| class AzureADConfigurationStore : OpenIDConnectConfigurationWithRoleStore<AzureADConfiguration>, IAzureADConfigurationStore | ||
| { | ||
| public const string SingletonId = "authentication-aad"; | ||
| ISystemLog log; | ||
|
|
||
| public override string Id => SingletonId; | ||
|
|
||
| public override string ConfigurationSettingsName => "AzureAD"; | ||
|
|
||
| public AzureADConfigurationStore( | ||
| IConfigurationStore configurationStore) : base(configurationStore) | ||
| IConfigurationStore configurationStore, ISystemLog log) : base(configurationStore) | ||
| { | ||
| this.log = log; | ||
| } | ||
|
|
||
| public SensitiveString? GetClientKey() => GetProperty(doc => doc.ClientKey); | ||
|
|
||
| public void SetClientKey(SensitiveString? key) => SetProperty(doc => | ||
| { | ||
| if (!string.IsNullOrEmpty(key?.Value)) | ||
| log.WithSensitiveValue(key.Value); | ||
|
|
||
| doc.ClientKey = key; | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
source/Server.AzureAD/Configuration/IAzureADConfigurationStore.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,13 @@ | ||
| using Octopus.Server.Extensibility.Authentication.OpenIDConnect.Common.Configuration; | ||
| using Octopus.Data.Model; | ||
| using Octopus.Server.Extensibility.Authentication.OpenIDConnect.Common.Configuration; | ||
|
|
||
| namespace Octopus.Server.Extensibility.Authentication.AzureAD.Configuration | ||
| { | ||
| interface IAzureADConfigurationStore : IOpenIDConnectConfigurationWithRoleStore<AzureADConfiguration> | ||
| { | ||
|
|
||
| SensitiveString? GetClientKey(); | ||
| void SetClientKey(SensitiveString? key); | ||
|
|
||
| } | ||
| } |
76 changes: 76 additions & 0 deletions
76
...Server.AzureAD/Configuration/MapFromAzureADConfigurationResourceToAzureADConfiguration.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Octopus.Core.Infrastructure.Mapping; | ||
| using Octopus.Data.Model; | ||
|
|
||
| namespace Octopus.Server.Extensibility.Authentication.AzureAD.Configuration | ||
| { | ||
| class MapFromAzureADConfigurationResourceToAzureADConfiguration : IMapToNew<AzureADConfigurationResource, AzureADConfiguration>, IMapToExisting<AzureADConfigurationResource, AzureADConfiguration> | ||
| { | ||
| public async Task<AzureADConfiguration> Map(AzureADConfigurationResource source, CancellationToken cancellationToken) | ||
| { | ||
| await Task.CompletedTask; | ||
| var target = new AzureADConfiguration(); | ||
|
|
||
| target.IsEnabled = source.IsEnabled; | ||
| target.Issuer = source.Issuer; | ||
| target.RoleClaimType = source.RoleClaimType; | ||
| target.AllowAutoUserCreation = source.AllowAutoUserCreation ?? false; | ||
| target.ClientId = source.ClientId; | ||
|
|
||
| if (source.ClientSecret is { HasValue: true, NewValue: { } }) | ||
| { | ||
| target.ClientSecret = source.ClientSecret.NewValue.ToSensitiveString(); | ||
| } | ||
|
|
||
| if (source.ClientSecret is not { HasValue: true }) | ||
| { | ||
| target.ClientSecret = null; | ||
| } | ||
|
|
||
| if (source.ClientKey is { HasValue: true, NewValue: { } }) | ||
| { | ||
| target.ClientKey = source.ClientKey.NewValue.ToSensitiveString(); | ||
| } | ||
|
|
||
| if (source.ClientKey is not { HasValue: true }) | ||
| { | ||
| target.ClientKey = null; | ||
| } | ||
|
|
||
| return target; | ||
| } | ||
|
|
||
| public async Task Map(AzureADConfigurationResource source, AzureADConfiguration target, CancellationToken cancellationToken) | ||
| { | ||
| await Task.CompletedTask; | ||
|
|
||
| target.IsEnabled = source.IsEnabled; | ||
| target.Issuer = source.Issuer; | ||
| target.RoleClaimType = source.RoleClaimType; | ||
| target.AllowAutoUserCreation = source.AllowAutoUserCreation ?? false; | ||
| target.ClientId = source.ClientId; | ||
|
|
||
| if (source.ClientSecret is { HasValue: true, NewValue: { } }) | ||
| { | ||
| target.ClientSecret = source.ClientSecret.NewValue.ToSensitiveString(); | ||
| } | ||
|
|
||
| if (source.ClientSecret is not { HasValue: true }) | ||
| { | ||
| target.ClientSecret = null; | ||
| } | ||
|
|
||
| if (source.ClientKey is { HasValue: true, NewValue: { } }) | ||
| { | ||
| target.ClientKey = source.ClientKey.NewValue.ToSensitiveString(); | ||
| } | ||
|
|
||
| if (source.ClientKey is not { HasValue: true }) | ||
| { | ||
| target.ClientKey = null; | ||
| } | ||
| } | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
...Server.AzureAD/Configuration/MapFromAzureADConfigurationToAzureADConfigurationResource.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Octopus.Core.Infrastructure.Mapping; | ||
| using Octopus.Server.MessageContracts; | ||
|
|
||
| namespace Octopus.Server.Extensibility.Authentication.AzureAD.Configuration | ||
| { | ||
| class MapFromAzureADConfigurationToAzureADConfigurationResource : IMapToNew<AzureADConfiguration, AzureADConfigurationResource> | ||
| { | ||
| public async Task<AzureADConfigurationResource> Map(AzureADConfiguration source, CancellationToken cancellationToken) | ||
| { | ||
| await Task.CompletedTask; | ||
|
|
||
| var target = new AzureADConfigurationResource(); | ||
|
|
||
| target.Id = source.Id; | ||
| target.IsEnabled = source.IsEnabled; | ||
| target.AllowAutoUserCreation = source.AllowAutoUserCreation; | ||
| target.RoleClaimType = source.RoleClaimType; | ||
| target.Issuer = source.Issuer; | ||
| target.ClientId = source.ClientId; | ||
|
|
||
| if (source.ClientSecret == null) | ||
| { | ||
| target.ClientSecret = null; | ||
| } | ||
| else | ||
| { | ||
| target.ClientSecret = !string.IsNullOrWhiteSpace(source.ClientSecret?.Value) ? new SensitiveValue { HasValue = true } : new SensitiveValue { HasValue = false }; | ||
| } | ||
|
|
||
| if (source.ClientKey == null) | ||
| { | ||
| target.ClientKey = null; | ||
| } | ||
| else | ||
| { | ||
| target.ClientKey = !string.IsNullOrWhiteSpace(source.ClientKey?.Value) ? new SensitiveValue { HasValue = true } : new SensitiveValue { HasValue = false }; | ||
| } | ||
|
|
||
| return target; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be $env:PROGRAMDATA