Ejemplo n.º 1
0
        public async Task <ActionResult> Index()
        {
            var ssoClient     = new SsoClient();
            var tokenResponse = await ssoClient.RequestTokenAsync("goodsam11", "5473d95926b2d0e00730786a");

            return(View(tokenResponse));
        }
Ejemplo n.º 2
0
        async static Task Main(string[] args)
        {
            var ssoClient     = new SsoClient();
            var tokenResponse = await ssoClient.RequestTokenAsync("goodsam11", "5473d95926b2d0e00730786a");

            Console.WriteLine(tokenResponse.TokenResponseVersion);
            Console.WriteLine(tokenResponse.StatusCode);
            Console.WriteLine(tokenResponse.RequestStatusFlag);
            Console.WriteLine(tokenResponse.Token);
            Console.WriteLine(tokenResponse.TokenDurationInSeconds);

            await ssoClient.AbaqisLoginAsync(tokenResponse.Token, "http://www.yahoo.com");
        }
Ejemplo n.º 3
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            var ssoClient     = new SsoClient();
            var tokenResponse = await ssoClient.RequestTokenAsync("goodsam11", "5473d95926b2d0e00730786a");

            if (tokenResponse.StatusCode.ToString() == "Ok")
            {
                Token = tokenResponse.Token;
            }
            else
            {
                Message.InnerHtml += "</br>";
                Message.InnerHtml += tokenResponse.TokenResponseVersion + "</br>";
                Message.InnerHtml += tokenResponse.StatusCode.ToString() + "</br>";
                Message.InnerHtml += tokenResponse.RequestStatusFlag.ToString() + "</br>";
                Message.InnerHtml += tokenResponse.Token + "</br>";
                Message.InnerHtml += tokenResponse.TokenDurationInSeconds.ToString() + "</br>";
            }
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> LoginToAbaqis()
        {
            var ssoClient     = new SsoClient();
            var tokenResponse = await ssoClient.RequestTokenAsync("goodsam11", "5473d95926b2d0e00730786a");

            var response = await ssoClient.AbaqisLoginPostAsync(tokenResponse.Token, "http://www.yahoo.com");

            var cookieToSet = response.Headers.GetValues("Set-Cookie").FirstOrDefault();

            if (cookieToSet != null)
            {
                var cookies = cookieToSet.Split(';');
                foreach (var cookie in cookies)
                {
                    var cookiePair = cookie.Split('=');
                    Response.Cookies.Add(new HttpCookie(cookiePair[0], cookiePair.Length == 2 ? cookiePair[1] : string.Empty));
                }
            }

            return(new RedirectResult(response.Headers.Location.ToString()));
        }