Skip to content

Add Domeneshop Context-based credential flow and initial domains command#14

Draft
Marius Storhaug (MariusStorhaug) wants to merge 4 commits into
mainfrom
context-credentials-setup
Draft

Add Domeneshop Context-based credential flow and initial domains command#14
Marius Storhaug (MariusStorhaug) wants to merge 4 commits into
mainfrom
context-credentials-setup

Conversation

@MariusStorhaug

Copy link
Copy Markdown
Member

Summary

  • add Connect-DomeneshopAccount to store API token/secret in a Domeneshop Context vault
  • add Get-DomeneshopContext plus config helpers to resolve and track the default context
  • add Get-DomeneshopDomain and Invoke-DomeneshopApiRequest to call GET /domains using HTTP Basic Auth from stored credentials
  • add Pester coverage for the new context/auth flow and API request behavior

Why

The module needed a secure credential flow aligned with PSModule patterns and Domeneshop API authentication requirements (basicAuth: token as username, secret as password).

Validation

  • Invoke-Pester -Path .\tests\PSModuleTest.Tests.ps1,./tests/DomeneshopContext.Tests.ps1 -Output Detailed

Store Domeneshop API credentials with Context and add a first authenticated domains command with a shared request helper.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Load function scripts in test runtime and cover credential storage, default context behavior, domain query construction, and basic auth request execution.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Fail ❌
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSReviewUnusedParameter             Warning      Get-Domene 19    The parameter
                                                 shopContex        'ListAvailab
                                                 t.ps1            le' has been
                                                                  declared but
                                                                  not used.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 47    File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 66    File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Get-Domene 1     The cmdlet 'G
                                                 shopConfig       et-Domeneshop
                                                 .ps1             Config' does
                                                                  not have a he
                                                                  lp comment.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Resolve-Do 1     The cmdlet 'R
                                                 meneshopCo       esolve-Domene
                                                 ntext.ps1        shopContext'
                                                                  does not have
                                                                   a help comme
                                                                  nt.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Set-Domene 1     The cmdlet 'S
                                                 shopDefaul       et-Domeneshop
                                                 tContext.p       DefaultContex
                                                 s1               t' does not h
                                                                  ave a help co
                                                                  mment.
PSUseShouldProcessForStateChangingF Warning      Set-Domene 1     Function 'Set
unctions                                         shopDefaul       -DomeneshopDe
                                                 tContext.p       faultContext'
                                                 s1                has verb tha
                                                                  t could chang
                                                                  e system stat
                                                                  e. Therefore,
                                                                   the function
                                                                   has to suppo
                                                                  rt 'ShouldPro
                                                                  cess'.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Invoke-Dom 1     The cmdlet 'I
                                                 eneshopApi       nvoke-Domenes
                                                 Request.ps       hopApiRequest
                                                 1                ' does not ha
                                                                  ve a help com
                                                                  ment.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error        Connect-Do 33    File 'Connect
thPlainText                                      meneshopAc       -DomeneshopAc
                                                 count.ps1        count.ps1' us
                                                                  es ConvertTo-
                                                                  SecureString
                                                                  with plaintex
                                                                  t. This will
                                                                  expose secure
                                                                   information.
                                                                   Encrypted st
                                                                  andard string
                                                                  s should be u
                                                                  sed instead.

Add public cmdlets for domains by ID, DNS CRUD, forwards CRUD, DDNS update, and invoices list/get. Reuse Context-based auth for all requests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Cover URI/method construction for domains, DNS, forwards, invoices, and DDNS commands using mocked API invocations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Fail ❌
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error        Connect-Do 33    File 'Connect
thPlainText                                      meneshopAc       -DomeneshopAc
                                                 count.ps1        count.ps1' us
                                                                  es ConvertTo-
                                                                  SecureString
                                                                  with plaintex
                                                                  t. This will
                                                                  expose secure
                                                                   information.
                                                                   Encrypted st
                                                                  andard string
                                                                  s should be u
                                                                  sed instead.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSReviewUnusedParameter             Warning      Get-Domene 19    The parameter
                                                 shopContex        'ListAvailab
                                                 t.ps1            le' has been
                                                                  declared but
                                                                  not used.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning      Set-Domene 1     Function 'Set
unctions                                         shopForwar       -DomeneshopFo
                                                 d.ps1            rward' has ve
                                                                  rb that could
                                                                   change syste
                                                                  m state. Ther
                                                                  efore, the fu
                                                                  nction has to
                                                                   support 'Sho
                                                                  uldProcess'.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning      Update-Dom 1     Function 'Upd
unctions                                         eneshopDdn       ate-Domenesho
                                                 s.ps1            pDdns' has ve
                                                                  rb that could
                                                                   change syste
                                                                  m state. Ther
                                                                  efore, the fu
                                                                  nction has to
                                                                   support 'Sho
                                                                  uldProcess'.
PSUseSingularNouns                  Warning      Update-Dom 1     The cmdlet 'U
                                                 eneshopDdn       pdate-Domenes
                                                 s.ps1            hopDdns' uses
                                                                   a plural nou
                                                                  n. A singular
                                                                   noun should
                                                                  be used inste
                                                                  ad.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 47    File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 66    File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 84    File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 102   File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 121   File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 140   File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 167   File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 202   File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.
PSAvoidUsingConvertToSecureStringWi Error        Domeneshop 224   File 'Domenes
thPlainText                                      Context.Te       hopContext.Te
                                                 sts.ps1          sts.ps1' uses
                                                                   ConvertTo-Se
                                                                  cureString wi
                                                                  th plaintext.
                                                                   This will ex
                                                                  pose secure i
                                                                  nformation. E
                                                                  ncrypted stan
                                                                  dard strings
                                                                  should be use
                                                                  d instead.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning      Set-Domene 1     Function 'Set
unctions                                         shopDnsRec       -DomeneshopDn
                                                 ord.ps1          sRecord' has
                                                                  verb that cou
                                                                  ld change sys
                                                                  tem state. Th
                                                                  erefore, the
                                                                  function has
                                                                  to support 'S
                                                                  houldProcess'
                                                                  .


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Get-Domene 1     The cmdlet 'G
                                                 shopConfig       et-Domeneshop
                                                 .ps1             Config' does
                                                                  not have a he
                                                                  lp comment.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Resolve-Do 1     The cmdlet 'R
                                                 meneshopCo       esolve-Domene
                                                 ntext.ps1        shopContext'
                                                                  does not have
                                                                   a help comme
                                                                  nt.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning      Set-Domene 1     Function 'Set
unctions                                         shopDefaul       -DomeneshopDe
                                                 tContext.p       faultContext'
                                                 s1                has verb tha
                                                                  t could chang
                                                                  e system stat
                                                                  e. Therefore,
                                                                   the function
                                                                   has to suppo
                                                                  rt 'ShouldPro
                                                                  cess'.
PSProvideCommentHelp                Information  Set-Domene 1     The cmdlet 'S
                                                 shopDefaul       et-Domeneshop
                                                 tContext.p       DefaultContex
                                                 s1               t' does not h
                                                                  ave a help co
                                                                  mment.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Get-Domene 1     The cmdlet 'G
                                                 shopApiBas       et-Domeneshop
                                                 eUri.ps1         ApiBaseUri' d
                                                                  oes not have
                                                                  a help commen
                                                                  t.


�[32;1mRuleName                           �[0m�[32;1m Severity    �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m--------                           �[0m �[32;1m--------    �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp                Information  Invoke-Dom 1     The cmdlet 'I
                                                 eneshopApi       nvoke-Domenes
                                                 Request.ps       hopApiRequest
                                                 1                ' does not ha
                                                                  ve a help com
                                                                  ment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant