Skip to content
Permalink
Branch: master
Find file Copy path
2 contributors

Users who have contributed to this file

@mshcruz @IMiHaIEl
244 lines (244 sloc) 17.1 KB
<Activity mc:Ignorable="sap sap2010 sads" x:Class="GetCredentials"
xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
xmlns:ss="clr-namespace:System.Security;assembly=mscorlib"
xmlns:ui="http://schemas.uipath.com/workflow/activities"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property sap2010:Annotation.AnnotationText="Username associated with the specified credential." Name="out_Username" Type="OutArgument(x:String)" />
<x:Property sap2010:Annotation.AnnotationText="Name of the credential to be retrieved." Name="in_Credential" Type="InArgument(x:String)" />
<x:Property sap2010:Annotation.AnnotationText="Password associated with the specified credential." Name="out_Password" Type="OutArgument(ss:SecureString)" />
</x:Members>
<mva:VisualBasic.Settings>
<x:Null />
</mva:VisualBasic.Settings>
<sap2010:WorkflowViewState.IdRef>GetCredentials_1</sap2010:WorkflowViewState.IdRef>
<TextExpression.NamespacesForImplementation>
<sco:Collection x:TypeArguments="x:String">
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>Microsoft.VisualBasic</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Data</x:String>
<x:String>System.Diagnostics</x:String>
<x:String>System.Drawing</x:String>
<x:String>System.IO</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Net.Mail</x:String>
<x:String>System.Xml</x:String>
<x:String>System.Xml.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Framework.Activities</x:String>
<x:String>System.Windows.Markup</x:String>
<x:String>System.Security</x:String>
</sco:Collection>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<sco:Collection x:TypeArguments="AssemblyReference">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
<AssemblyReference>mscorlib</AssemblyReference>
<AssemblyReference>System.Data</AssemblyReference>
<AssemblyReference>System</AssemblyReference>
<AssemblyReference>System.Drawing</AssemblyReference>
<AssemblyReference>System.Core</AssemblyReference>
<AssemblyReference>System.Xml</AssemblyReference>
<AssemblyReference>System.Xml.Linq</AssemblyReference>
<AssemblyReference>UiPath.Core</AssemblyReference>
<AssemblyReference>UiPath.Framework.Activities</AssemblyReference>
<AssemblyReference>PresentationFramework</AssemblyReference>
<AssemblyReference>WindowsBase</AssemblyReference>
<AssemblyReference>PresentationCore</AssemblyReference>
<AssemblyReference>System.Xaml</AssemblyReference>
<AssemblyReference>System.ServiceModel</AssemblyReference>
<AssemblyReference>System.ComponentModel.Composition</AssemblyReference>
<AssemblyReference>TimeSpan2</AssemblyReference>
<AssemblyReference>System.Runtime.WindowsRuntime</AssemblyReference>
<AssemblyReference>UiPath.Excel</AssemblyReference>
</sco:Collection>
</TextExpression.ReferencesForImplementation>
<TryCatch sap2010:Annotation.AnnotationText="Securely fetch or create and use a set of credentials.&#xA;&#xA;First, there is an attempt to fetch credentials from Orchestrator using the name received as argument. &#xA;If it is not possible to retrieve those credentials from Orchestrator, there is an attempt to fetch them from the Windows Credential Manager (WCM). &#xA;If the credentials are not defined in the WCM, the user is prompted to create the credentials that will be added to the WCM and returned for use during the process execution.&#xA;&#xA;The Private property is used to prevent the generation of logs that might contain information about the credentials." DisplayName="Private: Get Application Credentials" sap2010:WorkflowViewState.IdRef="TryCatch_2">
<TryCatch.Variables>
<Variable x:TypeArguments="x:String" Name="StringPassword" />
</TryCatch.Variables>
<TryCatch.Try>
<ui:GetRobotCredential TimeoutMS="{x:Null}" sap2010:Annotation.AnnotationText="Attempt to retrieve credentials from Orchestrator." AssetName="[in_Credential]" DisplayName="Get credentials" sap2010:WorkflowViewState.IdRef="GetRobotCredential_2" Password="[out_Password]" Username="[out_Username]" />
</TryCatch.Try>
<TryCatch.Catches>
<Catch x:TypeArguments="s:Exception" sap2010:WorkflowViewState.IdRef="Catch`1_2">
<ActivityAction x:TypeArguments="s:Exception">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="s:Exception" Name="Exception" />
</ActivityAction.Argument>
<If sap2010:Annotation.AnnotationText="The Private property is used to prevent the generation of logs that might contain information about the credentials." Condition="[out_Username Is Nothing Or out_Password Is Nothing]" DisplayName="Private: Fetch local credentials" sap2010:WorkflowViewState.IdRef="If_4">
<If.Then>
<Sequence sap2010:Annotation.AnnotationText="The Private property is used to prevent the generation of logs that might contain information about the credentials." DisplayName="Private: Get asset from Windows Credential Manager" sap2010:WorkflowViewState.IdRef="Sequence_6">
<Sequence.Variables>
<Variable x:TypeArguments="x:Boolean" Name="CredentialsFound" />
</Sequence.Variables>
<ui:GetSecureCredential sap2010:Annotation.AnnotationText="Attempt to retrieve credentials from the Windows Credential Manager." CredentialType="Generic" DisplayName="Get secure credential" sap2010:WorkflowViewState.IdRef="GetSecureCredential_1" Password="[out_Password]" PersistanceType="Enterprise" Result="[CredentialsFound]" Target="[in_Credential]" Username="[out_Username]" />
<If Condition="[Not CredentialsFound]" DisplayName="If credentials are not defined in the Windows Credential Manager" sap2010:WorkflowViewState.IdRef="If_3">
<If.Then>
<Sequence sap2010:Annotation.AnnotationText="The Private property is used to prevent the generation of logs that might contain information about the credentials." DisplayName="Request and store credentials" sap2010:WorkflowViewState.IdRef="Sequence_5">
<ui:RequestCredential sap2010:Annotation.AnnotationText="Request credentials from user." DisplayName="Request credentials" sap2010:WorkflowViewState.IdRef="RequestCredential_2" Message="[&quot;Please provide &quot;&quot;&quot; + in_Credential + &quot;&quot;&quot; access credentials&quot;]" Password="[StringPassword]" Result="[CredentialsFound]" Title="Hello! This is Robot" Username="[out_Username]" />
<If sap2010:Annotation.AnnotationText="Throw exception in case of no credentials, or add provided credentials to Windows Credential Manager." Condition="[Not CredentialsFound]" DisplayName="If credential request is cancelled" sap2010:WorkflowViewState.IdRef="If_5">
<If.Then>
<Throw DisplayName="Throw (no credentials)" Exception="[new Exception(&quot;Credentials not supplied&quot;)]" sap2010:WorkflowViewState.IdRef="Throw_1" />
</If.Then>
<If.Else>
<ui:AddCredential sap2010:Annotation.AnnotationText="Add provided credentials to the Windows Credential Manager to avoid requesting them in later executions of the process." CredentialType="Generic" DisplayName="Add Credential" sap2010:WorkflowViewState.IdRef="AddCredential_2" Password="[StringPassword]" PersistanceType="Enterprise" Target="[in_Credential]" Username="[out_Username]" />
</If.Else>
</If>
<Sequence sap2010:Annotation.AnnotationText="Convert manually provided password to SecureString." DisplayName="Convert password" sap2010:WorkflowViewState.IdRef="Sequence_9">
<Assign DisplayName="Assign out_Password (initialization)" sap2010:WorkflowViewState.IdRef="Assign_16">
<Assign.To>
<OutArgument x:TypeArguments="ss:SecureString">[out_Password]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="ss:SecureString">[New SecureString()]</InArgument>
</Assign.Value>
</Assign>
<ui:ForEach x:TypeArguments="x:Char" DisplayName="For each character in password" sap2010:WorkflowViewState.IdRef="ForEach`1_5" Values="[StringPassword.ToCharArray]">
<ui:ForEach.Body>
<ActivityAction x:TypeArguments="x:Char">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="x:Char" Name="PasswordCharacter" />
</ActivityAction.Argument>
<InvokeMethod DisplayName="Invoke method (AppendChar)" sap2010:WorkflowViewState.IdRef="InvokeMethod_2" MethodName="AppendChar">
<InvokeMethod.TargetObject>
<InArgument x:TypeArguments="ss:SecureString">[out_Password]</InArgument>
</InvokeMethod.TargetObject>
<InArgument x:TypeArguments="x:Char">[PasswordCharacter]</InArgument>
</InvokeMethod>
</ActivityAction>
</ui:ForEach.Body>
</ui:ForEach>
</Sequence>
</Sequence>
</If.Then>
</If>
</Sequence>
</If.Then>
</If>
</ActivityAction>
</Catch>
</TryCatch.Catches>
<sads:DebugSymbol.Symbol>d1JDOlxVc2Vyc1xNYXRldXMgQ3J1elxEb2N1bWVudHNcR2l0SHViXFJlRnJhbWVXb3JrXEZyYW1ld29ya1xHZXRBcHBDcmVkZW50aWFscy54YW1sJ0kDjAEOAgEBTgdOsQICATdWC4cBEAIBAk6UAU6lAQIBPE6eAk6uAgIBOk6EAk6UAgIBOFayAVboAQIBA1gPhQEaAgEGXBFcjwMCAS5dEYQBFgIBB1zhAlzyAgIBNVz8AlyMAwIBM1zFAlzZAgIBMVyQAlygAgIBL10fXTcCAQhfFYIBIAIBCmAXYKsDAgEkYRdoHAIBGGkXgQEiAgELYNABYLkCAgEsYJgDYKgDAgEqYN0CYPECAgEoYPgCYI4DAgEnYMMCYNUCAgElYa8BYccBAgEZYxtjtQECASJmG2afAwIBG2oZcSICARRyGYABJgIBDGNRY4gBAgEjZvECZoIDAgEgZowDZpwDAgEeZroCZswCAgEcb0tvXwIBF2xMbFoCARVyoAFyvgECARJ4H30uAgENfEZ8WQIBEHpRel8CAQ4=</sads:DebugSymbol.Symbol>
</TryCatch>
<sap2010:WorkflowViewState.ViewStateManager>
<sap2010:ViewStateManager>
<sap2010:ViewStateData Id="GetRobotCredential_2" sap:VirtualizedContainerService.HintSize="200,64">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="GetSecureCredential_1" sap:VirtualizedContainerService.HintSize="200,79">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="RequestCredential_2" sap:VirtualizedContainerService.HintSize="200,49">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="Throw_1" sap:VirtualizedContainerService.HintSize="200,22" />
<sap2010:ViewStateData Id="AddCredential_2" sap:VirtualizedContainerService.HintSize="200,109">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="If_5" sap:VirtualizedContainerService.HintSize="200,123">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="Assign_16" sap:VirtualizedContainerService.HintSize="287,60" />
<sap2010:ViewStateData Id="InvokeMethod_2" sap:VirtualizedContainerService.HintSize="217,132" />
<sap2010:ViewStateData Id="ForEach`1_5" sap:VirtualizedContainerService.HintSize="287,266" />
<sap2010:ViewStateData Id="Sequence_9" sap:VirtualizedContainerService.HintSize="200,93">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="Sequence_5" sap:VirtualizedContainerService.HintSize="222,541">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="If_3" sap:VirtualizedContainerService.HintSize="200,51">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="Sequence_6" sap:VirtualizedContainerService.HintSize="222,366">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="If_4" sap:VirtualizedContainerService.HintSize="464,556">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="Catch`1_2" sap:VirtualizedContainerService.HintSize="404,21">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="TryCatch_2" sap:VirtualizedContainerService.HintSize="418,498">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="GetCredentials_1" sap:VirtualizedContainerService.HintSize="458,578" />
</sap2010:ViewStateManager>
</sap2010:WorkflowViewState.ViewStateManager>
</Activity>
You can’t perform that action at this time.