Add ID constraint selection to the service selection implementation
authorAlberto Ruiz <aruiz@gnome.org>
Wed, 20 Jul 2011 12:13:52 +0000 (13:13 +0100)
committerAlberto Ruiz <aruiz@gnome.org>
Wed, 20 Jul 2011 12:13:52 +0000 (13:13 +0100)
src/moonshot-window.vala
webprovisioning/complex-test.msht [new file with mode: 0644]

index 5522953..9ae8806 100644 (file)
@@ -527,7 +527,15 @@ class MainWindow : Window
             }
             
             if (candidates.length () > 1)
-                confirm = true;
+            {
+                if (has_nai && nai_provided != null)
+                {
+                    identity = nai_provided;
+                    confirm = false;
+                }
+                else
+                    confirm = true;
+            }
             else
                 identity = candidates.nth_data (0);
             
diff --git a/webprovisioning/complex-test.msht b/webprovisioning/complex-test.msht
new file mode 100644 (file)
index 0000000..3fe1ce8
--- /dev/null
@@ -0,0 +1,68 @@
+<identities>
+  <identity>
+    <display-name>Unique Name</display-name>
+    <user>user1</user>
+    <password></password>
+    <realm>foo.baz</realm>
+    <services>
+      <service>xmpp@jabber.project-moonshot.org</service>
+    </services>
+    <selection-rules>
+      <rule>
+        <pattern>PATTERN</pattern>
+        <always-confirm>true</always-confirm>
+      </rule>
+      <rule>
+      <rule>
+        <pattern>imap@*moonshot.org</pattern>
+        <always-confirm>false</always-confirm>
+      </rule>
+      </rule>
+    </selection-rules>
+    <trust-anchor>
+      <ca-cert>ABCDEFGHIJKLMNOPQRSTUVWXYZ123455678910</ca-cert>
+      <subject>Foo</subject>
+      <subject-alt>Bar</subject-alt>
+      <!-- Or alternatively -->
+      <server-cert>ABCDEFGHIJKLMNOPQRSTUVWXYZ123455678910</server-cert>
+    </trust-anchor>
+  </identity>
+  <identity>
+    <display-name>Another Unique Name</display-name>
+    <user>user2</user>
+    <password></password>
+    <realm>foo.bar</realm>
+    <services>
+      <service>email@project-moonshot.org</service>
+    </services>
+    <selection-rules>
+      <rule>
+        <pattern>*@project-moonshot.org</pattern>
+        <always-confirm>true</always-confirm>
+      </rule>
+    </selection-rules>
+    <trust-anchor>
+      <ca-cert>ABCDEFGHIJKLMNOPQRSTUVWXYZ123455678910</ca-cert>
+      <subject>Foo</subject>
+      <subject-alt>Bar</subject-alt>
+      <!-- Or alternatively -->
+      <server-cert>ABCDEFGHIJKLMNOPQRSTUVWXYZ123455678910</server-cert>
+    </trust-anchor>
+  </identity>
+    <identity>
+    <display-name>Yet Another Unique Name</display-name>
+    <user>user3</user>
+    <password></password>
+    <realm>foo.com</realm>
+    <services>
+      <service>email@project-moonshot.org</service>
+    </services>
+    <trust-anchor>
+      <ca-cert>ABCDEFGHIJKLMNOPQRSTUVWXYZ123455678910</ca-cert>
+      <subject>Foo</subject>
+      <subject-alt>Bar</subject-alt>
+      <!-- Or alternatively -->
+      <server-cert>ABCDEFGHIJKLMNOPQRSTUVWXYZ123455678910</server-cert>
+    </trust-anchor>
+  </identity>
+</identities>