Skip to content

Commit

Permalink
Connect-SFApp: Corrected bug with SSO sign in parsing results
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dodievich committed Oct 12, 2021
1 parent aad07da commit a484ce1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Commands/Authentication/ConnectAppCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Authentication;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;


namespace Snowflake.Powershell
{
[Cmdlet
Expand Down Expand Up @@ -550,7 +550,7 @@ protected override void ProcessRecord()
// <script>
// var params = {"account":"sfpscogs_dodievich_sso","appServerUrl":"https://apps-api.c1.westus2.azure.app.snowflake.com",.... "username":"DODIEVICH_ALT"}}
// if (window.opener && params.isPopupAuth) {
string paramsCarryingPageResult = HttpUtility.HtmlDecode(JSONHelper.getStringValueFromJToken(authenticationTokenWebPageObject, "resultPage"));
string paramsCarryingPageResult = Encoding.UTF8.GetString(Convert.FromBase64String(JSONHelper.getStringValueFromJToken(authenticationTokenWebPageObject, "resultPage")));
Regex regexParameters = new Regex(@"(?i)var params = ({.*})", RegexOptions.IgnoreCase);
match = regexParameters.Match(paramsCarryingPageResult);
if (match != null)
Expand Down
22 changes: 11 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ The output should look like this:
```
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Connect-SFApp 2021.10.7.0 SnowflakePS
Cmdlet Get-SFDashboards 2021.10.7.0 SnowflakePS
Cmdlet Get-SFFolders 2021.10.7.0 SnowflakePS
Cmdlet Get-SFQueryProfile 2021.10.7.0 SnowflakePS
Cmdlet Get-SFWorksheets 2021.10.7.0 SnowflakePS
Cmdlet Invoke-SFDashboard 2021.10.7.0 SnowflakePS
Cmdlet Invoke-SFWorksheet 2021.10.7.0 SnowflakePS
Cmdlet New-SFDashboard 2021.10.7.0 SnowflakePS
Cmdlet New-SFWorksheet 2021.10.7.0 SnowflakePS
Cmdlet Remove-SFDashboard 2021.10.7.0 SnowflakePS
Cmdlet Remove-SFWorksheet 2021.10.7.0 SnowflakePS
Cmdlet Connect-SFApp 2021.10.11.0 SnowflakePS
Cmdlet Get-SFDashboards 2021.10.11.0 SnowflakePS
Cmdlet Get-SFFolders 2021.10.11.0 SnowflakePS
Cmdlet Get-SFQueryProfile 2021.10.11.0 SnowflakePS
Cmdlet Get-SFWorksheets 2021.10.11.0 SnowflakePS
Cmdlet Invoke-SFDashboard 2021.10.11.0 SnowflakePS
Cmdlet Invoke-SFWorksheet 2021.10.11.0 SnowflakePS
Cmdlet New-SFDashboard 2021.10.11.0 SnowflakePS
Cmdlet New-SFWorksheet 2021.10.11.0 SnowflakePS
Cmdlet Remove-SFDashboard 2021.10.11.0 SnowflakePS
Cmdlet Remove-SFWorksheet 2021.10.11.0 SnowflakePS
```

## Connect-SFApp
Expand Down
6 changes: 3 additions & 3 deletions SnowflakePS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<AssemblyName>SnowflakePS</AssemblyName>
<RootNamespace>Snowflake.Powershell</RootNamespace>

<Version>2021.10.7.0</Version>
<FileVersion>2021.10.7.0</FileVersion>
<AssemblyVersion>2021.10.7.0</AssemblyVersion>
<Version>2021.10.11.0</Version>
<FileVersion>2021.10.11.0</FileVersion>
<AssemblyVersion>2021.10.11.0</AssemblyVersion>
<Authors>Daniel Odievich (daniel.odievich@snowflake.com)</Authors>
<Company>Snowflake Computing</Company>
<Product>Snowflake Snowsight Extensions</Product>
Expand Down
2 changes: 1 addition & 1 deletion SnowflakePS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
RootModule = 'SnowflakePS.dll'

# Version number of this module.
ModuleVersion = '2021.10.7.0'
ModuleVersion = '2021.10.11.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
3 changes: 2 additions & 1 deletion UtilityDrivers/SnowflakeDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;

Expand Down Expand Up @@ -743,7 +744,7 @@ private static string apiGET(string baseUrl, string restAPIUrl, string acceptHea
{
if (cookie.StartsWith("user-") == true)
{
resultString = String.Format("{{\"authenticationCookie\": \"{0}\", \"resultPage\": \"{1}\"}}", cookie, HttpUtility.HtmlEncode(resultString));
resultString = String.Format("{{\"authenticationCookie\": \"{0}\", \"resultPage\": \"{1}\"}}", cookie, Convert.ToBase64String(Encoding.UTF8.GetBytes(resultString)));
}
}
}
Expand Down

0 comments on commit a484ce1

Please sign in to comment.