Skip to content

Commit

Permalink
Auth - Windows Authentication fixed
Browse files Browse the repository at this point in the history
closes #234
  • Loading branch information
wsmelton committed Sep 7, 2021
1 parent 6f3f056 commit 270e5b1
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 90 deletions.
177 changes: 89 additions & 88 deletions src/Thycotic.SecretServer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Shawn Melton
#
# Generated on: 9/3/2021
# Generated on: 9/6/2021
#

@{
Expand Down Expand Up @@ -69,93 +69,94 @@ FormatsToProcess = 'Thycotic.SecretServer.Format.ps1xml'
NestedModules = @('bin\Thycotic.SecretServer.dll')

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-TssEventPipeline', 'Add-TssFolderPermission',
'Add-TssGroupMember', 'Add-TssSecretPermission',
'Add-TssSecretTemplateField', 'Close-TssSecret', 'Close-TssSession',
'Disable-TssEventPipeline', 'Disable-TssEventPipelinePolicy',
'Disable-TssSecretCheckout', 'Disable-TssSecretEmail',
'Disable-TssUnlimitedAdmin', 'Disable-TssUser',
'Enable-TssEventPipeline', 'Enable-TssEventPipelinePolicy',
'Enable-TssSecretCheckout', 'Enable-TssSecretEmail',
'Enable-TssUnlimitedAdmin', 'Enable-TssUser',
'Export-TssAutoExportStorageItem', 'Export-TssReport',
'Find-TssFolder', 'Find-TssGroup', 'Find-TssReport', 'Find-TssSecret',
'Find-TssUser', 'Get-TssConfiguration',
'Get-TssConfigurationAutoExport', 'Get-TssConfigurationBackup',
'Get-TssConfigurationLocalUserPassword',
'Get-TssConfigurationLogin', 'Get-TssConfigurationRpc',
'Get-TssConfigurationSaml', 'Get-TssConfigurationSearchIndex',
'Get-TssConfigurationSecurity', 'Get-TssConfigurationSiteConnector',
'Get-TssEventPipeline', 'Get-TssEventPipelinePolicy',
'Get-TssEventPipelinePolicyActivity', 'Get-TssEventPipelineRun',
'Get-TssFolder', 'Get-TssFolderAudit', 'Get-TssFolderPermission',
'Get-TssFolderState', 'Get-TssGroup', 'Get-TssGroupMember',
'Get-TssGroupRole', 'Get-TssGroupUser', 'Get-TssMetadataField',
'Get-TssReport', 'Get-TssReportCategory', 'Get-TssReportParameter',
'Get-TssReportSchedule', 'Get-TssRpcAssociatedSecret',
'Get-TssRpcPasswordType', 'Get-TssScript', 'Get-TssSecret',
'Get-TssSecretAccessRequest', 'Get-TssSecretAccessRequestOption',
'Get-TssSecretAccessRequestSecret', 'Get-TssSecretAttachment',
'Get-TssSecretAudit', 'Get-TssSecretDependency',
'Get-TssSecretDependencyGroup', 'Get-TssSecretDependencyRunStatus',
'Get-TssSecretDependencyScript', 'Get-TssSecretDependencyStub',
'Get-TssSecretDependencyTemplate', 'Get-TssSecretField',
'Get-TssSecretHeartbeatStatus', 'Get-TssSecretHook',
'Get-TssSecretHookStub', 'Get-TssSecretPasswordStatus',
'Get-TssSecretPolicy', 'Get-TssSecretSetting', 'Get-TssSecretState',
'Get-TssSecretStub', 'Get-TssSecretSummary', 'Get-TssSecretTemplate',
'Get-TssSecretTemplateFolder', 'Get-TssSite', 'Get-TssUser',
'Get-TssUserAudit', 'Get-TssUserGroup', 'Get-TssUserOwner',
'Get-TssUserRole', 'Get-TssUserRoleAssigned', 'Get-TssVersion',
'Initialize-TssSdkClient', 'Invoke-TssReport', 'Invoke-TssRestApi',
'Invoke-TssSecretGeneratePassword', 'Lock-TssUser', 'New-TssFolder',
'New-TssFolderPermission', 'New-TssGroup', 'New-TssMetadataField',
'New-TssReport', 'New-TssReportSchedule', 'New-TssScript',
'New-TssSecret', 'New-TssSecretDependency',
'New-TssSecretDependencyGroup', 'New-TssSecretHook',
'New-TssSecretPermission', 'New-TssSecretPolicy',
'New-TssSecretTemplate', 'New-TssSecretTemplateField',
'New-TssSession', 'New-TssUser', 'Open-TssSecret',
'Remove-TssEventPipeline', 'Remove-TssFolder',
'Remove-TssFolderPermission', 'Remove-TssFolderTemplate',
'Remove-TssGroupMember', 'Remove-TssMetadata', 'Remove-TssReport',
'Remove-TssReportCategory', 'Remove-TssReportSchedule',
'Remove-TssSecret', 'Remove-TssSecretDependency',
'Remove-TssSecretHook', 'Remove-TssSecretPermission',
'Remove-TssUserPii', 'Reset-TssUserPassword', 'Restore-TssSecret',
'Revoke-TssSecret', 'Search-TssAutoExportStorage',
'Search-TssConfigurationAudit', 'Search-TssConfigurationBackupLog',
'Search-TssDirectoryServiceDomain',
'Search-TssDistributedEngineSite', 'Search-TssEventPipeline',
'Search-TssEventPipelinePolicy', 'Search-TssFolder',
'Search-TssFolderPermission', 'Search-TssGroup', 'Search-TssMetadata',
'Search-TssMetadataHistory', 'Search-TssMetadataSection',
'Search-TssReport', 'Search-TssReportSchedule', 'Search-TssRole',
'Search-TssRpcPasswordType', 'Search-TssScript', 'Search-TssSecret',
'Search-TssSecretAccessRequest', 'Search-TssSecretDependency',
'Search-TssSecretHook', 'Search-TssSecretPermission',
'Search-TssSecretPolicy', 'Search-TssSecretTemplate',
'Search-TssSystemLog', 'Search-TssUser', 'Search-TssWorkflowTemplate',
'Set-TssConfigurationAutoExport', 'Set-TssConfigurationGeneral',
'Set-TssConfigurationLocalUserPassword',
'Set-TssConfigurationLogin', 'Set-TssConfigurationRpc',
'Set-TssConfigurationSecurity', 'Set-TssFolder', 'Set-TssSecret',
'Set-TssSecretExpiration', 'Set-TssSecretField',
'Set-TssSecretPolicy', 'Set-TssSecretRpcAssociated',
'Set-TssSecretRpcPrivileged', 'Set-TssSecretSecurity',
'Set-TssSecretTemplate', 'Show-TssCurrentUser',
'Start-TssConfigurationBackup', 'Start-TssConfigurationSearchIndex',
'Start-TssDiscovery', 'Start-TssSecretChangePassword',
'Start-TssSecretDependency', 'Start-TssSecretHeartbeat',
'Stop-TssSecretChangePassword', 'Test-TssFolderAction',
'Test-TssSdkClient', 'Test-TssSecretAction', 'Test-TssSecretState',
'Test-TssSession', 'Test-TssVersion', 'Unlock-TssUser',
'Update-TssFolder', 'Update-TssFolderPermission',
'Update-TssGroupMember', 'Update-TssMetadataField',
'Update-TssMetadataSection', 'Update-TssSecret',
'Update-TssSecretAccessRequest', 'Update-TssSecretHook',
'Update-TssSecretPermission', 'Update-TssSecretRdpLauncherSetting',
'Update-TssSecretTemplateField', 'Update-TssUser',
FunctionsToExport = 'Add-TssEventPipeline', 'Add-TssFolderPermission',
'Add-TssGroupMember', 'Add-TssSecretPermission',
'Add-TssSecretTemplateField', 'Close-TssSecret', 'Close-TssSession',
'Disable-TssEventPipeline', 'Disable-TssEventPipelinePolicy',
'Disable-TssSecretCheckout', 'Disable-TssSecretEmail',
'Disable-TssUnlimitedAdmin', 'Disable-TssUser',
'Enable-TssEventPipeline', 'Enable-TssEventPipelinePolicy',
'Enable-TssSecretCheckout', 'Enable-TssSecretEmail',
'Enable-TssUnlimitedAdmin', 'Enable-TssUser',
'Export-TssAutoExportStorageItem', 'Export-TssReport',
'Find-TssFolder', 'Find-TssGroup', 'Find-TssReport', 'Find-TssSecret',
'Find-TssUser', 'Get-TssConfiguration',
'Get-TssConfigurationAutoExport', 'Get-TssConfigurationBackup',
'Get-TssConfigurationLocalUserPassword',
'Get-TssConfigurationLogin', 'Get-TssConfigurationRpc',
'Get-TssConfigurationSaml', 'Get-TssConfigurationSearchIndex',
'Get-TssConfigurationSecurity', 'Get-TssConfigurationSiteConnector',
'Get-TssEventPipeline', 'Get-TssEventPipelinePolicy',
'Get-TssEventPipelinePolicyActivity', 'Get-TssEventPipelineRun',
'Get-TssFolder', 'Get-TssFolderAudit', 'Get-TssFolderPermission',
'Get-TssFolderState', 'Get-TssGroup', 'Get-TssGroupMember',
'Get-TssGroupRole', 'Get-TssGroupUser', 'Get-TssMetadataField',
'Get-TssReport', 'Get-TssReportCategory', 'Get-TssReportParameter',
'Get-TssReportSchedule', 'Get-TssRpcAssociatedSecret',
'Get-TssRpcPasswordType', 'Get-TssScript', 'Get-TssSecret',
'Get-TssSecretAccessRequest', 'Get-TssSecretAccessRequestOption',
'Get-TssSecretAccessRequestSecret', 'Get-TssSecretAttachment',
'Get-TssSecretAudit', 'Get-TssSecretDependency',
'Get-TssSecretDependencyGroup', 'Get-TssSecretDependencyRunStatus',
'Get-TssSecretDependencyScript', 'Get-TssSecretDependencyStub',
'Get-TssSecretDependencyTemplate', 'Get-TssSecretField',
'Get-TssSecretHeartbeatStatus', 'Get-TssSecretHook',
'Get-TssSecretHookStub', 'Get-TssSecretPasswordStatus',
'Get-TssSecretPolicy', 'Get-TssSecretPolicyItemStub',
'Get-TssSecretPolicyStub', 'Get-TssSecretSetting',
'Get-TssSecretState', 'Get-TssSecretStub', 'Get-TssSecretSummary',
'Get-TssSecretTemplate', 'Get-TssSecretTemplateFolder', 'Get-TssSite',
'Get-TssUser', 'Get-TssUserAudit', 'Get-TssUserGroup',
'Get-TssUserOwner', 'Get-TssUserRole', 'Get-TssUserRoleAssigned',
'Get-TssVersion', 'Initialize-TssSdkClient', 'Invoke-TssReport',
'Invoke-TssRestApi', 'Invoke-TssSecretGeneratePassword',
'Lock-TssUser', 'New-TssFolder', 'New-TssFolderPermission',
'New-TssGroup', 'New-TssMetadataField', 'New-TssReport',
'New-TssReportSchedule', 'New-TssScript', 'New-TssSecret',
'New-TssSecretDependency', 'New-TssSecretDependencyGroup',
'New-TssSecretHook', 'New-TssSecretPermission', 'New-TssSecretPolicy',
'New-TssSecretTemplate', 'New-TssSecretTemplateField',
'New-TssSession', 'New-TssUser', 'Open-TssSecret',
'Remove-TssEventPipeline', 'Remove-TssFolder',
'Remove-TssFolderPermission', 'Remove-TssFolderTemplate',
'Remove-TssGroupMember', 'Remove-TssMetadata', 'Remove-TssReport',
'Remove-TssReportCategory', 'Remove-TssReportSchedule',
'Remove-TssSecret', 'Remove-TssSecretDependency',
'Remove-TssSecretHook', 'Remove-TssSecretPermission',
'Remove-TssUserPii', 'Reset-TssUserPassword', 'Restore-TssSecret',
'Revoke-TssSecret', 'Search-TssAutoExportStorage',
'Search-TssConfigurationAudit', 'Search-TssConfigurationBackupLog',
'Search-TssDirectoryServiceDomain',
'Search-TssDistributedEngineSite', 'Search-TssEventPipeline',
'Search-TssEventPipelinePolicy', 'Search-TssFolder',
'Search-TssFolderPermission', 'Search-TssGroup', 'Search-TssMetadata',
'Search-TssMetadataHistory', 'Search-TssMetadataSection',
'Search-TssReport', 'Search-TssReportSchedule', 'Search-TssRole',
'Search-TssRpcPasswordType', 'Search-TssScript', 'Search-TssSecret',
'Search-TssSecretAccessRequest', 'Search-TssSecretDependency',
'Search-TssSecretHook', 'Search-TssSecretPermission',
'Search-TssSecretPolicy', 'Search-TssSecretTemplate',
'Search-TssSystemLog', 'Search-TssUser', 'Search-TssWorkflowTemplate',
'Set-TssConfigurationAutoExport', 'Set-TssConfigurationGeneral',
'Set-TssConfigurationLocalUserPassword',
'Set-TssConfigurationLogin', 'Set-TssConfigurationRpc',
'Set-TssConfigurationSecurity', 'Set-TssFolder', 'Set-TssSecret',
'Set-TssSecretExpiration', 'Set-TssSecretField',
'Set-TssSecretPolicy', 'Set-TssSecretRpcAssociated',
'Set-TssSecretRpcPrivileged', 'Set-TssSecretSecurity',
'Set-TssSecretTemplate', 'Show-TssCurrentUser',
'Start-TssConfigurationBackup', 'Start-TssConfigurationSearchIndex',
'Start-TssDiscovery', 'Start-TssSecretChangePassword',
'Start-TssSecretDependency', 'Start-TssSecretHeartbeat',
'Stop-TssSecretChangePassword', 'Test-TssFolderAction',
'Test-TssSdkClient', 'Test-TssSecretAction', 'Test-TssSecretState',
'Test-TssSession', 'Test-TssVersion', 'Unlock-TssUser',
'Update-TssFolder', 'Update-TssFolderPermission',
'Update-TssGroupMember', 'Update-TssMetadataField',
'Update-TssMetadataSection', 'Update-TssSecret',
'Update-TssSecretAccessRequest', 'Update-TssSecretHook',
'Update-TssSecretPermission', 'Update-TssSecretRdpLauncherSetting',
'Update-TssSecretTemplateField', 'Update-TssUser',
'Update-TssUserPassword', 'Write-TssSecretAccessRequestViewComment'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
Expand Down
10 changes: 8 additions & 2 deletions src/Thycotic.SecretServer/cmdlets/private/InvokeTssApiCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ protected override void ProcessRecord()

var apiRequest = new RestRequest(Method);
apiRequest.AddHeader("Content-Type", ContentType);
apiRequest.AddHeader("Authorization", "Bearer " + AccessToken);

if (MyInvocation.BoundParameters.ContainsKey("AccessToken"))
{
apiRequest.AddHeader("Authorization", "Bearer " + AccessToken);
}
if (MyInvocation.BoundParameters.ContainsKey("UseDefaultCredential"))
{
apiRequest.UseDefaultCredentials = true;
}
if (MyInvocation.BoundParameters.ContainsKey("Body"))
{
apiRequest.AddParameter(ContentType, Body, ParameterType.RequestBody);
Expand Down

0 comments on commit 270e5b1

Please sign in to comment.