# ESSO Configuring Rules for Single Sign On



# Configuring Rules for Single Sign On

## Configuring Single Sign-on

<div data-hasbody="false" data-headerelements="H2" data-macro-name="toc" id="bkmrk-user-interface-patte">- <span class="toc-item-body" data-outline="1">[User interface pattern recognition](#bkmrk-user-interface-patte-0)</span>
- <span class="toc-item-body" data-outline="2">[Web interfaces pattern recognition](#bkmrk-web-interfaces-patte)</span>
- <span class="toc-item-body" data-outline="3">[Configuring rules for basic / kerberos authentication](#bkmrk-configuring-rules-fo)</span>

</div>SSO system is configured based on the detection of administrator defined User Interface patterns. The system currently supports native Windows applications, Java applications and Web applications.

The UI Patterns are expressed with XML files associated with each application entry point. They are composed of:

- **Rules** for detecting user interfaces (defined like application attributes or elements).
- **Action** to be taken on user interface recognition. (defined with the action element for the application).

Complementary to the rules defined in Sofifd Console, the synchronization server manages a repository of user accounts and passwords, as well as other information generically known as **secrets**. In general, the system will handle any number of secrets as well as any number of accounts for each managed systems. Anyway, each account for a managed system will have only one password.

All secrets can be used and manipulated using a scripting language fully compatible with ECMA-Script, also known as Javascript.

## User interface pattern recognition

The user interface detection for Windows and Java applications is done using the <u>**Application**</u> tag. This tag will contain one or more Component tagged elements. Each component could have many nested components. Each component could have one or more actions to perform when the user focus is at a selected component.

Next is a sample to inject the secret name “JconsolePassword” into jconsole application:

<div id="bkmrk-%3Cmazinger%3E-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%3C"><table class="wrapped confluenceTable" style="width: 100%;"><tbody><tr><td class="confluenceTd" colspan="1" style="width: 84.2917%;">&lt;Mazinger&gt;

 &lt;<span style="color: #0000ff;">**Application**</span> cmdLine = '.\*jconsole$'&gt;

 &lt;<span style="color: #008000;">**Component**</span> class = 'sun.tools.jconsole.JConsole' title = 'Java Monitoring &amp; Management Console' name = 'frame0'&gt;

 &lt;<span style="color: #008000;">**Component**</span> class = 'sun.tools.jconsole.JConsole\\$FixedJRootPane'&gt;

 &lt;<span style="color: #008000;">**Component**</span> class = 'javax.swing.JPanel' name = 'null.glassPane' /&gt;

 &lt;<span style="color: #008000;">**Component**</span> class = 'javax.swing.JLayeredPane' name = 'null.layeredPane'&gt;

 &lt;<span style="color: #008000;">**Component**</span> class = 'javax.swing.JPanel' name = 'null.contentPane'&gt;

 ....

 &lt;<span style="color: #008000;">**Component**</span> class = 'javax.swing.JPasswordField' text ='' ref-as = 'password'&gt;

</td><td class="confluenceTd" colspan="1" style="width: 15.7083%;">Patterns to be match

</td></tr><tr><td class="confluenceTd" style="width: 84.2917%;"> &lt;<span style="color: #ff6600;">**Action**</span> type='script' event='onFocus'&gt;

 &lt;! \[CDATA \[

 var account = secretStore.getAccount('soffid');

 var password = secretStore.getPassword('soffid', account);

 debug ('user =' + account);

 debug ('password =' + password);

 password.setText (secretStore.getSecret ('password'));

 \]\]&gt;

 &lt;/ **<span style="color: #ff6600;">Action</span>**&gt;

</td><td class="confluenceTd" style="width: 15.7083%;">The action you want to be executed

</td></tr><tr><td class="confluenceTd" colspan="1" style="width: 84.2917%;">....</td><td class="confluenceTd" colspan="1" style="width: 15.7083%;">  
</td></tr></tbody></table>

</div>Thus, when the system detects that the user is within a window that meets the XML specification and the password text box is the focus owner, Soffid will execute the script action that is bound. This one will show the user password in a jconsole application field.

The Application contains in the attribute cmdLine a regular expression that is matched against the process command line. In the example, SSO will only match a running program with a command line that ends with "jconsole". It won't apply to jconsole.exe or “jconsole test”.

The element <span style="color: #0000ff;">**Application**</span> accepts the following attributes:

<div id="bkmrk-cmdline-regular-expr"><table class="wrapped confluenceTable"><colgroup><col></col><col></col></colgroup><tbody><tr><td class="confluenceTd">cmdLine

</td><td class="confluenceTd">Regular expression to match the command line.

</td></tr></tbody></table>

</div>The <span style="color: #008000;">**Component**</span> element allows the following attributes:

<div id="bkmrk-class-regular-expres"><table class="wrapped confluenceTable" style="width: 100%;"><colgroup><col style="width: 13.2175%;"></col><col style="width: 86.7825%;"></col></colgroup><tbody><tr><td class="confluenceTd">class

</td><td class="confluenceTd">Regular expression to validate against the kind of visual component, either a Java class or a window class.

</td></tr><tr><td class="confluenceTd">name

</td><td class="confluenceTd">Regular expression to match the name of the component. Applies only to Java components.

</td></tr><tr><td class="confluenceTd">text

</td><td class="confluenceTd">Regular expression to match the content of a text component

</td></tr><tr><td class="confluenceTd">title

</td><td class="confluenceTd">Regular expression to match the title of a java component.

</td></tr><tr><td class="confluenceTd">dlgId

</td><td class="confluenceTd">Regular expression to match window ID dialog on Windows component.

</td></tr><tr><td class="confluenceTd">optional

</td><td class="confluenceTd">If the value is true, the presence of the component is not considered critical to trigger actions associated dialogue.

</td></tr><tr><td class="confluenceTd">check

</td><td class="confluenceTd">When the check attribute has the value “**partial**”, the matcher engine considers the user interface component matches the XML pattern even when it has one or more children components that are not declared at the XML pattern.

If you specify the value **full** value or the attribute is missing, the component will not match the pattern if it has children are components not specified in XML descriptor. Thus, the rule will be ignored.

</td></tr><tr><td class="confluenceTd">ref-as

</td><td class="confluenceTd">Specifies a name of a ECMA-Script variable that will refer to this component.

</td></tr></tbody></table>

</div>The <span style="color: #ff6600;">**Action**</span> element accepts the following attributes:

<div id="bkmrk-event-name-of-the-ev"><table class="wrapped confluenceTable" style="width: 82.716%;"><colgroup><col style="width: 16.1326%;"></col><col style="width: 83.8674%;"></col></colgroup><tbody><tr><td class="confluenceTd">event

</td><td class="confluenceTd">Name of the event that will trigger the action. In the current version must be set to "onFocus"

</td></tr><tr><td class="confluenceTd">type

</td><td class="confluenceTd">Indicates the type of action. Can have the following values:

**setText:** Assigns a text value to the owner component.

**script.** Run the specified script.

</td></tr><tr><td class="confluenceTd">text

</td><td class="confluenceTd">Text to assign, for setText actions.

</td></tr><tr><td class="confluenceTd">repeat

</td><td class="confluenceTd">If set to true, the action will be executed as many times as necessary.

Otherwise, it will only run once per process.

</td></tr><tr><td class="confluenceTd">delay

</td><td class="confluenceTd">Time (in seconds) that must be elapsed before the action is executed again.

</td></tr></tbody></table>

</div>## Web interfaces pattern recognition

The detection is done using the element <u>**WebApplication**</u>. This tag is independent of the browser used, and is based solely on the content of web document. Thus, the same rule will work both on Mozilla Firefox, Google Chrome or Internet Explorer.

<div id="bkmrk-%3Cmazinger%3E-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%3C-0"><table class="wrapped confluenceTable"><colgroup><col></col><col></col></colgroup><tbody><tr><td class="confluenceTd">&lt;Mazinger&gt;

 &lt;<span style="color: #0000ff;">**WebApplication**</span> url = '[https://www.caib.es](https://www.caib.es/). \*' title = 'Government of the Balearic Islands'&gt;

 &lt;<span style="color: #800000;">**Form**</span> action = "j\_security\_check"&gt;

 &lt;**Input** name="j\_username" ref-as="u"/&gt;

 &lt;**Input** name="j\_password" type="password" ref-as="p"/&gt;

 &lt;**Input** type="Submit" ref-as="b" /&gt;

</td><td class="confluenceTd">Patterns to be match

</td></tr><tr><td class="confluenceTd"> &lt;<span style="color: #ff6600;">**Action**</span> Type='script' event='onLoad'&gt;

 &lt;! \[CDATA \[

 debug('User =' + secretStore.getAccount ('user'));

 debug ('password =' + secretStore.getPassword('soffid', account));

 u.setAttribute ('value' secretStore.getAccount ('user'));

 p.setAttribute ('value' secretStore.getPassword('soffid', account));

 b.click();

 \]\]&gt;

 &lt;/<span style="color: #ff6600;">**Action**</span>&gt;

</td><td class="confluenceTd">Action you want to be executed

</td></tr><tr><td class="confluenceTd" colspan="1"> &lt;/<span style="color: #800000;">**Form**</span>&gt;

 &lt;/<span style="color: #0000ff;">**WebApplication**</span>&gt;

&lt;/Mazinger&gt;

</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

</div>Thus, when the system detects that the browser has loaded a page matching the XML specification (url, title, and components), it will run the actions that have been associated.

Mind that despite the actions being coded in Javascript, it is not the Browser javascript engine. Thus, you cannot use browser variables or functions.

The element <span style="color: #0000ff;">**WebApplication**</span> accepts the following attributes:

<div id="bkmrk-url-regular-expressi"><table class="wrapped confluenceTable"><colgroup><col></col><col></col></colgroup><tbody><tr><td class="confluenceTd">url

</td><td class="confluenceTd">Regular expression to match the page address

</td></tr><tr><td class="confluenceTd">title

</td><td class="confluenceTd">Regular expression to match the title of the page

</td></tr><tr><td class="confluenceTd">content

</td><td class="confluenceTd">Regular expression to match the HTML content of the page

</td></tr></tbody></table>

</div>The <span style="color: #800000;">**Form**</span> element will search in the HTML document for a form that matches the specified attributes. It can optionally contain one or more input elements that must be present in the HTML document. It accepts the following attributes:

<div id="bkmrk-id-regular-expressio"><table class="wrapped confluenceTable"><colgroup><col></col><col></col></colgroup><tbody><tr><td class="confluenceTd">id

</td><td class="confluenceTd">Regular expression to match the ID attribute of the element

</td></tr><tr><td class="confluenceTd">name

</td><td class="confluenceTd">Regular expression to match the element name

</td></tr><tr><td class="confluenceTd">method

</td><td class="confluenceTd">Regular expression to match the form element's method attribute.

</td></tr><tr><td class="confluenceTd">action

</td><td class="confluenceTd">Regular expression to match the form element's action attribute.

</td></tr><tr><td class="confluenceTd">ref-as

</td><td class="confluenceTd">Specifies a name of a ECMA-Script variable that will refer to this form.

</td></tr><tr><td class="confluenceTd">optional

</td><td class="confluenceTd">A value of **true** indicates that its presence is not necessary for the execution of actions.

</td></tr></tbody></table>

</div>The **Input** element will search in the HTML document for an input element that matches the specified attributes. Input elements can be located within WebApplication or Form elements. In the first case, you will find there is any input into the document. In the second case, just find the type items included in the input form found.

<div id="bkmrk-id-regular-expressio-0"><table class="wrapped confluenceTable"><colgroup><col></col><col></col></colgroup><tbody><tr><td class="confluenceTd">id

</td><td class="confluenceTd">Regular expression to match the ID attribute of the element

</td></tr><tr><td class="confluenceTd">name

</td><td class="confluenceTd">Regular expression to match the element name

</td></tr><tr><td class="confluenceTd">type

</td><td class="confluenceTd">Regular expression to match the input type

</td></tr><tr><td class="confluenceTd">value

</td><td class="confluenceTd">Regular expression to match the input value.

</td></tr><tr><td class="confluenceTd">ref-as

</td><td class="confluenceTd">Specifies a name of a ECMA-Script variable that will refer to this form.

</td></tr><tr><td class="confluenceTd">optional

</td><td class="confluenceTd">A value of **true** indicates that its presence is not necessary for the execution of actions.

</td></tr></tbody></table>

</div>The <span style="color: #ff6600;">**Action**</span> element accepts the following attributes:

<div id="bkmrk-event-name-of-the-ev-0"><table class="wrapped confluenceTable"><colgroup><col></col><col></col></colgroup><tbody><tr><td class="confluenceTd">event

</td><td class="confluenceTd">Name of the event that will trigger the action. In the current version must be set to "onFocus"

</td></tr><tr><td class="confluenceTd">type

</td><td class="confluenceTd">Indicates the type of action. Can have the following values:

**setText:** Not supported

**script.** Run the specified script.

</td></tr><tr><td class="confluenceTd">repeat

</td><td class="confluenceTd">If set to true, the action will be executed as many times as necessary.

Otherwise, it will only run once per process.

</td></tr><tr><td class="confluenceTd">delay

</td><td class="confluenceTd">Time (in seconds) that must be elapsed before the action is executed again.

</td></tr></tbody></table>

</div>## Configuring rules for basic / kerberos authentication

Some web pages are still using basic or kerberos authentication mechanisms. These mechanisms do not present a web page to be filled in by the user. Thus, the ESSO engine cannot detect it using the method described previously.

Instead, starting from Soffid ESSO version 3.0.0, there is a new tag to teach the ESSO which credentials to send in these cases. The rules will be like the next ones:

```
<Mazinger>
  <WebTransport url="https://no-soffid.bubu.lab:4443/" system="OSCM"/>
  <WebTransport url="https://no-ad.bubu.lab/" system="ad" domain="AD"/>
</Mazinger>
```

<div data-hasbody="true" data-macro-name="code" id="bkmrk-the-tag-to-use-is-we"><div><div><div>The tag to use is WebTransport. It has three parameters:</div></div></div></div><div id="bkmrk-attribute-value-url-"><table class="confluenceTable tablesorter tablesorter-default stickyTableHeaders" role="grid" style="width: 100%;"><colgroup><col style="width: 11.2425%;"></col><col style="width: 88.7575%;"></col></colgroup><thead class="tableFloatingHeaderOriginal"><tr class="tablesorter-headerRow" role="row"><th aria-disabled="false" aria-label="Attribute: No sort applied, activate to apply an ascending sort" aria-sort="none" class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="0" role="columnheader" scope="col" tabindex="0"><div>Attribute</div></th><th aria-disabled="false" aria-label="Value: No sort applied, activate to apply an ascending sort" aria-sort="none" class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="1" role="columnheader" scope="col" tabindex="0"><div>Value</div></th></tr></thead><tbody aria-live="polite" aria-relevant="all"><tr role="row"><td class="confluenceTd">url</td><td class="confluenceTd">The base url to use. Include the protocol and port number when needed. Any BASIC, NTLM or Kerberos authentication requested by that server will be automatically answered with the credentials present in the password vault</td></tr><tr role="row"><td class="confluenceTd">system</td><td class="confluenceTd">The ESSO will send any credential that the user has in that system. Other credentials will be ignored</td></tr><tr role="row"><td class="confluenceTd" colspan="1">domain</td><td class="confluenceTd" colspan="1">This is an optional attribute. It's required when trying to use Kerberos or NTLM authentication if the account name does not contain the domain name part. If the account contains the domain name, this attribute should not be present.

</td></tr></tbody></table>

</div>Due to the different ways that browsers address this kind of authentication, the user interface will be displayed according to the browser settings. For instance, Edge and Internet Explorer will display a UA dialog box.

# Support and configuration tools

## Introduction

**KojiKabuto.exe, the main Soffid ESSO component**, picks settings and rules automatically from Soffid synchronization server at login. This configuration can be updated by running the command "KojiKabuto update". Once run, new rules will apply to all new processes. Mind that application processes that where running before the update is done will still use the old rules set.

Additionally, you can drive SSO by yourself for testing purposes. Mazinger.exe is the command line version of Soffid ESSO. It accepts the following commands:

To stop SSO service:

```
mazinger stop
```

To start Mazinger services:

```
mazinger start [-trace] [-debug] [file.mzn]
```

To get a configuration file, you can download from: https://&lt;synchronizationserver&gt;:760/getmazingerconfig?user = .....

The -debug switch allows Mazinger to display all the single sign on events that are produced at users applications.

The -trace switch is only inteded for debugging and support usage.

To view all the single sign on events on a running ESSO instance, you can run:

```western
mazinger debug
```

To view current SSO service status, run:

```
mazinger status
```

Mazinger can also dump XML files describing the applications user interface. This XML files can be used to describe SSO rules. To dump this XML descriptors, execute:

```
mazinger spy
```

Mazinger spy and mazinger trace are very useful when you are creating a new ESSO rule in order to see what parameters, components, atributes, ... the application are using.

In order to execute this commands, you must go to the ESSO installation directory. For example, C:\\Program Files\\SoffidEsso\\mazinger.exe trace.

# ESSO Scripting Language

<p class="callout info">Visit the [ESSO Scripting Language](https://bookstack.soffid.com/books/esso/chapter/esso-scripting-language "ESSO Scripting Language") chapter.</p>

# Configuring terminal emulation SSO

## Introduction

To configure SSO on terminal emulations, an HLL API bridge has been built. This bridge allows direct communication with the terminal emulator in order to create accurate SSO rules that can be triggered based on the screen display.

Next, you have a sample rule for terminal emulation SSO:

**HLL API rule**

```
<Mazinger>
<HllApplication>
  <Pattern row="2">.*SOFFID.*</Pattern>
  <Pattern row="23">.*ABC.*</Pattern>
  <Action type="script" event="onMatch" repeat="true" delay="1">
     account = secretStore.getAccount ("390host");
     password = secretStore.getPassword ("390host", account);
     hll.setCursorLocation (22,3);
     hll.sendText ("HELLO "+account);
     hll.setCursorLocation (23, 3);
     hll.sendText ("YOUR PASSWORD IS "+password);
     hll.sendKeys("@E");
  </Action>
</HllApplication>
</Mazinger>
```

The rule should contain one or more patterns that will be matched against the specified row. If the screen matches all the specified patterns, the action will be executed as usual.

Nevertheless, HLL applications differ in some way from other application rules as long as the HLL engine (Sewashi) must be started separately from the ESSO engine. To active the HLL rules engine, the sewashi program must be started, specifying the HLL API used to interact with the terminal emulator, and optionally, the sessions to be managed:

```
%ProgramFiles%\SoffidESSO\Sewashi.exe --dll "%ProgramFiles%\IBM\Personal Communications\PCSHLL32.DLL" --sessions ABCDEFG
```

To stop the HLL engine, Sewashi --stop can be executed. This program can executed from Soffid login and logout scripts.