public async Task <ActionResult> SigninOIDC()
        {
            var authorizeResponse = oidcClient.GetAuthorizeResponse(Request.Form);

            if (String.IsNullOrEmpty(authorizeResponse.AccessToken))
            {
                var doc = await oidcClient.GetDiscoveryClient();

                var tokenResponse = await oidcClient.GetAccessToken(doc.TokenEndpoint, authorizeResponse.Code);

                var userInfoResponse = await oidcClient.GetUserInfo(doc.UserInfoEndpoint, tokenResponse.AccessToken);

                await SetUserSessionData(tokenResponse, userInfoResponse, AuthData.Decode(authorizeResponse.State));
            }
            return(View());
        }
Пример #2
0
        public ActionResult Login(string authData)
        {
            if (string.IsNullOrEmpty(authData))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var authDataDecoded = AuthData.Decode(authData);

            // basic scenarios perform well using in-memory session
            // advanced scenarios, please check session store
            Session.Add("BotId", authDataDecoded.BotId);
            Session.Add("userBotId", authDataDecoded.UserId);
            Session.Add("channelId", authDataDecoded.ChannelId);
            Session.Add("conversationId", authDataDecoded.ConversationId);
            Session.Add("serviceUrl", authDataDecoded.ServiceUrl);

            return(View());
        }