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

Problem with API Module #506

Open
nawazsarwar124 opened this issue Dec 19, 2023 · 3 comments
Open

Problem with API Module #506

nawazsarwar124 opened this issue Dec 19, 2023 · 3 comments

Comments

@nawazsarwar124
Copy link

Hello,

i have installed the safeguard-ps but encountring the error of powershell, i thought it's problem of powershell and i installed a virtualmachine but encountring the same error. Can someone please help:

PS C:\Windows\system32> Connect-Safeguard -Appliance 10.X.X.X -Insecure
Provider: local
Username: admin
400: Bad Request --
In C:\Program Files\WindowsPowerShell\Modules\safeguard-ps\7.4.126553\sg-utilities.psm1:181 car:5

  • throw $local:ExceptionToThrow
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (:) [], SafeguardMethodException
    • FullyQualifiedErrorId : 400: Bad Request --

PS C:\Windows\system32> Connect-Safeguard -Appliance 10.X.X.X -Insecure -Gui
Add-Type : (0) : Impossibile trovare il file di metadati 'System.Security.Cryptography.dll'
(1) : using System;
In C:\Program Files\WindowsPowerShell\Modules\safeguard-ps\7.4.126553\safeguard-ps.psm1:82 car:9

  •     Add-Type -ReferencedAssemblies $local:Assemblies -TypeDefinit ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
    • FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

    Thanks,
    NS

@petrsnd
Copy link
Member

petrsnd commented Jan 4, 2024

@nawazsarwar124 I am unable to reproduce the issue you are seeing. Could you give us more information about your environment?

Can you run the following?

PS> $PSVersionTable
PS> Get-Host

@nawazsarwar124
Copy link
Author

Hello @petrsnd thanks for your reply. I resolved the problem by degrating the version as lastest version was creating problem as mentioned above.

For time being i am not using that version, maybe in future...

Thanks again for you reply.

@Kevin-Andrew
Copy link
Contributor

I was able to reproduce the problem:
image

image

And it appears that it can be fixed by just deleting the ,"System.Security.Cryptography.dll" from:
https://github.com/OneIdentity/safeguard-ps/blob/release-7.5/src/safeguard-ps.psm1#L80

But then, at least for me, I immediately ran into another problem:
image

So that is complaining about:
https://github.com/OneIdentity/safeguard-ps/blob/release-7.5/src/safeguard-ps.psm1#L106

I don't think PowerShell supports the C# string interpolation, at least not PowerShell version 5.1. So I replaced it with:

string accessTokenUri = string.Format("https://{0}/RSTS/Login?response_type=code&code_challenge_method=S256&code_challenge={1}&redirect_uri={2}&port={3}", _appliance, OAuthCodeChallenge(CodeVerifier), redirectUri, port);

And it worked.

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

No branches or pull requests

3 participants