Exemple #1
0
        public ActionResult Index(HarnessViewModel model)
        {
            if (!string.IsNullOrWhiteSpace(Request.Params["btnLoginWithMiiCard"]))
            {
                return(this.LoginWithMiiCard(model));
            }

            if (!string.IsNullOrWhiteSpace(this.Request.Params["btn-invoke"]))
            {
                if (string.IsNullOrWhiteSpace(model.ConsumerKey) || string.IsNullOrWhiteSpace(model.ConsumerSecret) || string.IsNullOrWhiteSpace(model.AccessToken) || string.IsNullOrWhiteSpace(model.AccessTokenSecret))
                {
                    model.ShowOAuthDetailsRequiredError = true;
                }
                else
                {
                    var apiWrapper = new miiCard.Consumers.Service.v1.MiiCardOAuthClaimsService(model.ConsumerKey, model.ConsumerSecret, model.AccessToken, model.AccessTokenSecret);

                    switch (this.Request.Params["btn-invoke"])
                    {
                    case "get-claims":
                        model.LastGetClaimsResult = apiWrapper.GetClaims().Prettify();
                        break;

                    case "is-user-assured":
                        model.LastIsUserAssuredResult = apiWrapper.IsUserAssured().Prettify();
                        break;

                    case "is-social-account-assured":
                        if (!string.IsNullOrWhiteSpace(model.SocialAccountId) && !string.IsNullOrWhiteSpace(model.SocialAccountType))
                        {
                            model.LastIsSocialAccountAssuredResult = apiWrapper.IsSocialAccountAssured(model.SocialAccountId, model.SocialAccountType).Prettify();
                        }
                        break;

                    case "assurance-image":
                        if (!string.IsNullOrWhiteSpace(model.AssuranceImageType))
                        {
                            model.ShowAssuranceImage = true;
                        }
                        break;

                    case "get-identity-snapshot-details":
                        model.LastGetIdentitySnapshotDetailsResult = apiWrapper.GetIdentitySnapshotDetails(model.SnapshotDetailsId).Prettify();
                        break;

                    case "get-identity-snapshot":
                        if (!string.IsNullOrWhiteSpace(model.SnapshotId))
                        {
                            model.LastGetIdentitySnapshotResult = apiWrapper.GetIdentitySnapshot(model.SnapshotId).Prettify();
                        }
                        break;
                    }
                }
            }

            return(View(model));
        }
        public FileStreamResult AssuranceImage(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret, string type)
        {
            var apiWrapper = new miiCard.Consumers.Service.v1.MiiCardOAuthClaimsService(consumerKey, consumerSecret, accessToken, accessTokenSecret);

            FileStreamResult result = null;
            try
            {
                result = new FileStreamResult(apiWrapper.AssuranceImage(type), "image/png");
            }
            catch (Exception ex)
            {
                result = new FileStreamResult(new MemoryStream(), "image/png");
            }

            return result;
        }
Exemple #3
0
        public FileStreamResult AssuranceImage(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret, string type)
        {
            var apiWrapper = new miiCard.Consumers.Service.v1.MiiCardOAuthClaimsService(consumerKey, consumerSecret, accessToken, accessTokenSecret);

            FileStreamResult result = null;

            try
            {
                result = new FileStreamResult(apiWrapper.AssuranceImage(type), "image/png");
            }
            catch (Exception ex)
            {
                result = new FileStreamResult(new MemoryStream(), "image/png");
            }

            return(result);
        }
        public ActionResult Index(HarnessViewModel model)
        {
            if (!string.IsNullOrWhiteSpace(Request.Params["btnLoginWithMiiCard"]))
            {
                return this.LoginWithMiiCard(model);
            }

            if (!string.IsNullOrWhiteSpace(this.Request.Params["btn-invoke"]))
            {
                if (string.IsNullOrWhiteSpace(model.ConsumerKey) || string.IsNullOrWhiteSpace(model.ConsumerSecret) || string.IsNullOrWhiteSpace(model.AccessToken) || string.IsNullOrWhiteSpace(model.AccessTokenSecret))
                {
                    model.ShowOAuthDetailsRequiredError = true;
                }
                else
                {
                    var apiWrapper = new miiCard.Consumers.Service.v1.MiiCardOAuthClaimsService(model.ConsumerKey, model.ConsumerSecret, model.AccessToken, model.AccessTokenSecret);

                    switch (this.Request.Params["btn-invoke"])
                    {
                        case "get-claims":
                            model.LastGetClaimsResult = apiWrapper.GetClaims().Prettify();
                            break;
                        case "is-user-assured":
                            model.LastIsUserAssuredResult = apiWrapper.IsUserAssured().Prettify();
                            break;
                        case "is-social-account-assured":
                            if (!string.IsNullOrWhiteSpace(model.SocialAccountId) && !string.IsNullOrWhiteSpace(model.SocialAccountType))
                            {
                                model.LastIsSocialAccountAssuredResult = apiWrapper.IsSocialAccountAssured(model.SocialAccountId, model.SocialAccountType).Prettify();
                            }
                            break;
                        case "assurance-image":
                            if (!string.IsNullOrWhiteSpace(model.AssuranceImageType))
                            {
                                model.ShowAssuranceImage = true;
                            }
                            break;
                        case "get-identity-snapshot-details":
                            model.LastGetIdentitySnapshotDetailsResult = apiWrapper.GetIdentitySnapshotDetails(model.SnapshotDetailsId).Prettify();
                            break;
                        case "get-identity-snapshot":
                            if (!string.IsNullOrWhiteSpace(model.SnapshotId))
                            {
                                model.LastGetIdentitySnapshotResult = apiWrapper.GetIdentitySnapshot(model.SnapshotId).Prettify();
                            }
                            break;
                    }
                }
            }

            return View(model);
        }