Merge pull request #89 from NileshGhodekar/master

Regression Bug fix: WAL Lookup resolution support for PowerShellUserName and PowerShellUserPassword
This commit is contained in:
Nilesh Ghodekar 2020-07-23 14:30:52 +01:00 коммит произвёл GitHub
Родитель 23487d97da 32b72c1aa7
Коммит 0c63df8534
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 50 добавлений и 14 удалений

Просмотреть файл

@ -8,9 +8,10 @@
NOTE: Edit the Version and PublicKeyToken of the WAL AssemblyName to match the one that you have deployed in GAC.
Also edit the $encryptionCertThumbprint of cert to be used for certificate based encryption.
Finding Assembly verion and PublicKeyToken
gacutil.exe -l | findstr WorkflowActivityLibrary
Creatinig a self signed certificate for MIMWAL (You can use a legacy CSP such as Microsoft Strong Cryptographic Provider as shown in the example below)
To find Assembly verion and PublicKeyToken
.\gacutil.exe -l | findstr WorkflowActivityLibrary
To create a self-signed certificate for MIMWAL, you must use a legacy CSP (as .NET 3.5 only supports legacy CSPs).
You can use a legacy CSP such as Microsoft Strong Cryptographic Provider as shown in the example below:
$cert = New-SelfSignedCertificate -DnsName "MIMWAL Encryption (Do Not Delete)" -CertStoreLocation "cert:\LocalMachine\My" -Provider "Microsoft Strong Cryptographic Provider" -NotAfter (Get-Date).AddYears(20)
$cert.Thumbprint
As of version v2.18.1110.0, only FIMService account needs read access to the private key of the MIMWAL certificate created above.
@ -18,9 +19,9 @@
$Error.Clear()
$walAssemblyVersion = "2.20.0523.0"
$walAssemblyPublicKeyToken = "31bf3856ad364e35"
$encryptionCertThumbprint = "9C697919FB2FB2D6324ADE42D5F8CB49E8778C08" # cert to be used for encryption (from the cert:\localmachine\my\ store).
$walAssemblyVersion = "2.20.0723.0" # edit appropriately
$walAssemblyPublicKeyToken = "31bf3856ad364e35" # edit appropriately
$encryptionCertThumbprint = "9C697919FB2FB2D6324ADE42D5F8CB49E8778C08" # cert to be used for encryption (from the cert:\localmachine\my\ store). Edit appropriately
Add-Type -AssemblyName "System.Security"
# use the full name for WAL assembly to eliminate need to assembly redirects for dependent assemblies.

Просмотреть файл

@ -22,7 +22,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary
/// Build Number (MMDD)
/// Revision (if any on the same day)
/// </summary>
internal const string Version = "2.20.0523.0";
internal const string Version = "2.20.0723.0";
/// <summary>
/// File Version information for the assembly consists of the following four values:
@ -31,6 +31,6 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary
/// Build Number (MMDD)
/// Revision (if any on the same day)
/// </summary>
internal const string FileVersion = "2.20.0523.0";
internal const string FileVersion = "2.20.0723.0";
}
}

Просмотреть файл

@ -109,9 +109,18 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
// Function: contains ( and ends with )
// Lookup: starts with [// and ends with ]
// Variable: starts with $ and does not contain invalid characters
if (IdentifyExpressionComponents(parameter).Count > 1)
ArrayList components = IdentifyExpressionComponents(parameter, suppressValidationError);
if (components.Count > 1)
{
parameterType = ParameterType.Expression;
foreach (string component in components)
{
if (DetermineParameterType(component, suppressValidationError) == ParameterType.Unknown)
{
parameterType = ParameterType.Unknown;
break;
}
}
}
else if (long.TryParse(parameter, out parseInteger))
{
@ -449,8 +458,9 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
/// Identifies the expression components.
/// </summary>
/// <param name="expression">The expression.</param>
/// <param name="suppressValidationError">Indicates whether to suppress the validation error or not.</param>
/// <returns>The ArrayList of expression components.</returns>
private static ArrayList IdentifyExpressionComponents(string expression)
private static ArrayList IdentifyExpressionComponents(string expression, bool suppressValidationError)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponents, "Expression: '{0}'.", expression);
@ -484,12 +494,28 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
// parentheses characters do not match, throw an exception
if (openString)
{
throw Logger.Instance.ReportError(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponentsQuotesValidationError, new InvalidExpressionException(Messages.ExpressionEvaluator_ExpressionQuotesValidationError, expression));
if (suppressValidationError)
{
Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponentsQuotesValidationError, Messages.ExpressionEvaluator_ExpressionQuotesValidationError, expression);
return components;
}
else
{
throw Logger.Instance.ReportError(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponentsQuotesValidationError, new InvalidExpressionException(Messages.ExpressionEvaluator_ExpressionQuotesValidationError, expression));
}
}
if (openFunctions != 0)
{
throw Logger.Instance.ReportError(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponentsParenthesisValidationError, new InvalidExpressionException(Messages.ExpressionEvaluator_ExpressionParenthesisValidationError, expression));
if (suppressValidationError)
{
Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponentsParenthesisValidationError, Messages.ExpressionEvaluator_ExpressionParenthesisValidationError, expression);
return components;
}
else
{
throw Logger.Instance.ReportError(EventIdentifier.ExpressionEvaluatorIdentifyExpressionComponentsParenthesisValidationError, new InvalidExpressionException(Messages.ExpressionEvaluator_ExpressionParenthesisValidationError, expression));
}
}
// The function expression could contain + characters which are wrapped in quotations
@ -546,6 +572,16 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
}
}
/// <summary>
/// Identifies the expression components.
/// </summary>
/// <param name="expression">The expression.</param>
/// <returns>The ArrayList of expression components.</returns>
private static ArrayList IdentifyExpressionComponents(string expression)
{
return IdentifyExpressionComponents(expression, false);
}
/// <summary>
/// Escapes the string.
/// A string is escaped by removing the quotation marks at its start and finish and

Просмотреть файл

@ -2500,7 +2500,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
}
/// <summary>
/// This function is used to convert a date to the local time or specifed time zone.
/// This function is used to convert a date to the local time or specified time zone.
/// Function Syntax: DateTimeUtcToLocalTime(date:DateTime [, TimeZoneId])
/// </summary>
/// <returns>The value of the specified UTC date expressed in the local time or specified time zone.</returns>
@ -2848,7 +2848,6 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
index += 1;
}
}
}
Logger.Instance.WriteVerbose(EventIdentifier.ExpressionFunctionIndexByValue, "IndexByValue('{0}', '{1}') returned '{2}'.", this.parameters[0], this.parameters[1], result);