Skip to content

Instantly share code, notes, and snippets.

View pspete's full-sized avatar

Pete Maan pspete

View GitHub Profile
@infamousjoeg
infamousjoeg / samlAuthn.ps1
Last active November 15, 2022 15:13
An example of how to authenticate CyberArk PAS REST API using SAML **CUSTOMER CONTRIBUTED & UNTESTED**
try {
$webresp = Invoke-WebRequest "https://pvwa.example.com/PasswordVault/auth/saml/" -MaximumRedirection 0 -ErrorAction SilentlyContinue -UseBasicParsing
} catch {
$_.Exception.Response.StatusCode.Value__
}
try {
$samlresp = Invoke-WebRequest -Uri ($webresp.links.href) -MaximumRedirection 1 -UseDefaultCredentials -UseBasicParsing
} catch {
$_.Exception.Response.StatusCode.Value__
}
@jgard
jgard / Get-AWSTempCred.ps1
Last active January 12, 2022 00:23
Powershell: Get AWS temporary credentials via ADFS including support for RSA SecurID MFA
Function Get-AWSTempCred {
[CmdletBinding()]
param (
[string]$ADFSHost='adfs.domain.com', ##Change for environment-appropriate default if desired
[string]$RelyingParty = 'urn:amazon:webservices',
[pscredential]$Credential
)
$WebRequestParams=@{ #Initialize parameters object
Uri = "https://$ADFSHost/adfs/ls/IdpInitiatedSignon.aspx?LoginToRP=$RelyingParty"