Exemple #1
0
        public void LoginToSymplifiedToken()
        {
            SymplifiedAuthenticator authenticator = new SymplifiedAuthenticator(
                new Uri("https://idp.symplified.net"),
                new Uri("https://idp.symplified.net/portal/mobile/applications.html")
                );

            authenticator.Completed += (s, e) =>
            {
                loginViewController.DismissViewController(true, null);

                if (!e.IsAuthenticated)
                {
                    tokenLoginStatusStringElement.Caption = "Not authorized";
                }
                else
                {
                    tokenLoginStatusStringElement.Caption = "Authorized";
                    tokenLoginStatusStringElement.GetActiveCell().BackgroundColor = UIColor.Green;
                }

                loginViewController.ReloadData();
            };

            vc = authenticator.GetUI();
            loginViewController.PresentViewController(vc, true, null);
        }
Exemple #2
0
        private void Share(Service service, StringElement button)
        {
            Item item = new Item {
                Text  = "I'm sharing great things using Xamarin!",
                Links = new List <Uri> {
                    new Uri("http://xamarin.com"),
                },
            };

            UIViewController vc = service.GetShareUI(item, shareResult => {
                dialog.DismissViewController(true, null);

                button.GetActiveCell().TextLabel.Text = service.Title + " shared: " + shareResult;
            });

            dialog.PresentViewController(vc, true, null);
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var section = dvc.Root [0].Elements;

            var list = (from MemorizationElement e in section where e.ElementIsSelected select e.VerseForElement).ToList();

            dvc.PresentViewController(new FlipCardController(list), true, null);
        }
Exemple #4
0
        public void PerformSalesforceOAuthSaml2Grant()
        {
            XmlDocument xDoc = new XmlDocument();

            xDoc.PreserveWhitespace = true;
            xDoc.Load("salesforce-oauthsaml2-idp-metadata.xml");

            Saml20MetadataDocument idpMetadata = new Saml20MetadataDocument(xDoc);

            Saml20Authenticator authenticator = new Saml20Authenticator(
                "Symplified.Auth.iOS.Sample",
                idpMetadata
                );

            authenticator.Completed += (s, e) => {
                loginViewController.DismissViewController(true, null);

                if (!e.IsAuthenticated)
                {
                    samlLoginStatusStringElement.Caption = "Not authorized";
                    samlLoginStatusStringElement.GetActiveCell().BackgroundColor = UIColor.Red;
                }
                else
                {
                    SamlAccount authenticatedAccount = (SamlAccount)e.Account;
                    samlLoginStatusStringElement.Caption = authenticatedAccount.Assertion.Subject.Value;
                    samlLoginStatusStringElement.GetActiveCell().BackgroundColor = UIColor.Green;

                    authenticatedAccount.GetBearerAssertionAuthorizationGrant(
                        new Uri("https://login.salesforce.com/services/oauth2/token")
                        ).ContinueWith(t => {
                        if (!t.IsFaulted)
                        {
                            accessTokenStringElement.Caption = t.Result ["access_token"];
                            scopeStringElement.Caption       = t.Result ["scope"];

                            BeginInvokeOnMainThread(delegate {
                                loginViewController.ReloadData();
                                ListSalesforceResources(t.Result ["instance_url"], t.Result ["access_token"]);
                            });
                        }
                        else
                        {
                            Console.WriteLine("error");
                        }
                    });
                }

                loginViewController.ReloadData();
            };

            UIViewController vc = authenticator.GetUI();

            loginViewController.PresentViewController(vc, true, null);
        }
Exemple #5
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var section = dvc.Root [0].Elements;

            var list = (from MemorizationElement e in section where e.ElementIsSelected select e.VerseForElement).ToList();

            if (list.Count == 0)
            {
                new UIAlertView("Invalid Selection", "Oops! Select at least one verse to memorize!", null, "Okay", null).Show();
            }
            else
            {
                dvc.PresentViewController(new FlipCardController(list), true, null);
            }
        }
        public void Share(Service service, UITextView t)
        {
            Item item = new Item {
                Text  = "I'm sharing great things using Xamarin!",
                Links = new List <Uri> {
                    new Uri("http://xamarin.com"),
                },
            };

            UIViewController vc = service.GetShareUI(item, shareResult => {
                dialog.DismissViewController(true, null);

                t.Text = service.Title + " shared: " + shareResult;
            });

            dialog.PresentViewController(vc, true, null);
        }