-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Anonymous and certificate authentication #164
Anonymous and certificate authentication #164
Conversation
Copy-CommonParameter.ps1 -This function simplifies the propagating of parameters for splatting. -The default parameters are just the auth parameters Invoke-Method.ps1 -Updated to support pass Certificate to Invoke-WebRequest. -Rename $Uri to have a consistent case both inside and from callers. -Leveraged Copy-CommonParameters to simplify the code -Simplified the appending of the query parameter logic. -Fixed passing 'Body' to in the paginated results code path. Invoke-Method.md -Update docs to include the new Certificate Parameter.
Get-Page.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Get-Page.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Get-ChildPage.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. -Simplified the "Recurse" logic. -Identified issue handling ConfluencePS.Page objects via pipeline. Get-ChildPage.md -Added Certificate Parameter -Made Credential Parameter not mandatory Get-Page.md -Fixed 'ApiUri' casing in documentation
Add-Attachment.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Add-Attachment.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Add-Label.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Add-Label.md -Added Certificate Parameter -Made Credential Parameter not mandatory
…rmat ConvertTo-StorageFormat.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. ConvertTo-StorageFormat.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Get-Attachment.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Get-Attachment.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Get-AttachmentFile.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Get-AttachmentFile.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Get-Lebal.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Get-Label.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Get-Space.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Get-Space.md -Added Certificate Parameter -Made Credential Parameter not mandatory
New-Page.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. New-Page.md -Added Certificate Parameter -Made Credential Parameter not mandatory
New-Space.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. New-Space.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Remove-Attachment.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Remove-Attachment.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Remove-Label.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Remove-Label.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Remove-Page.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Remove-Page.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Remove-Space.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Remove-Space.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Set-Attachment.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Set-Attachment.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Set-Label.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Set-Label.md -Added Certificate Parameter -Made Credential Parameter not mandatory
Set-Page.ps1 -Added Certificate Parameter -Made Credential Parameter not mandatory -Rename $ApiUri to have proper casing. -Simplified the propagating of the the splatted parameters. Set-Page.md -Added Certificate Parameter -Made Credential Parameter not mandatory
@lipkau, Is there anything I can do to get this PR accepted? I would really like to use the official release of this module but my company's Atlassian setup requires Certificate Authentication. |
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.
Great job!
thanks for that!
I might require your help to move this to the v3 branch, as I don't have a setup where I can test if this works.
Ar you on the slack server already?
btw... this will be a nightmare to marge into my v3 branch :-( |
I can definitely help with porting these changes to the v3 branch. I have looked a bit at the v3 branch and the feature/useAtlassianPSConfiguration in your repo but I am unsure which is the best starting point. Is your plan to merge the feature/useAtlassianPSConfiguration feature branch into the v3 or into develop? I think you are merging feature/useAtlassianPSConfiguration into v3, correct? Should I wait until you do that or just start with feature/useAtlassianPSConfiguration? I was also interested in making these same changes to the JiraPS project. I wanted to get them accepted to the ConfluencePS project first before spending the time to make the same changes to the JiraPS project. Let me know the best way to proceed. |
yes. My intention is to update |
Description
This Pull Request adds support for using certificate authentication and removes the need for credentials for Confluence Servers that do not require them. While this may look like a huge change, it does touch almost all the files, at its heart it is just enabling each function to pass a certificate instead of PSCredentials to Invoke-WebRequest. Invoke-WebRequest already supports certificate authentication.
I accomplished the certificate support by changing how the splatting from the outer functions to Invoke-Method and then to Invoke-WebRequest happened. Along the way I created a helper function called Copy-CommonParameter to assist in copying the appropriate $PSBoundParameters to enable better handling of parameters. I used Copy-CommonParameters anytime I needed to pass the auth parameters (i.e. $Credential or $Certificate) to an inner function call. By leveraging splatting I didn't need to know which parameter was set.
As I was updating the passing of parameters logic via splatting, I took the opportunity to simplify some logic. I didn't make any changes that added or removed features. I did take the time to fix the casing on ApiUri and [uri] to be consistent with the other parameters.
I believe the code is actually easier to read and understand after this PR as its flow is much more straightforward.
Before submitting I ran all the included tests along with porting my some of my existing scripts to work with this module.
Motivation and Context
The motivation behind this commit is that I maintain my own private PowerShell Module/Scripts for Confluence. My work was more a thin wrapper on Invoke-RestMethod without many of niceties provided by this module or PowerShell Core 6 support. Though this module has one big limitation, I need to use certificate authentication with my instance of Confluence. So instead of trying to maintain my own private module/scripts I would like to contribute to an open source Confluence PowerShell Module. This commit would enable me to replace my existing work and be a starting point for future commits.
Types of changes
Checklist