Exemplo n.º 1
0
        /// <summary>テスト用にパラメタを保存</summary>
        /// <param name="isOidc">OIDCの場合、true</param>
        private void SaveOAuth2Params(bool isOidc)
        {
            // テスト用にパラメタを、Session, Cookieに保存
            // ・Session : サイト分割時
            // ・Cookie : 同一サイト時

            IResponseCookies responseCookies = MyHttpContext.Current.Response.Cookies;

            // client_id
            HttpContext.Session.SetString(Const.TestClientId, this.ClientId);
            responseCookies.Set(Const.TestClientId, this.ClientId);

            // state
            HttpContext.Session.SetString(Const.TestState, this.State);
            responseCookies.Set(Const.TestState, this.State);

            // redirect_uri
            if (!isOidc)
            {
                // OIDCはTokenリクエストにredirect_uriを指定しない。
                HttpContext.Session.SetString(Const.TestRedirectUri, this.RedirectUri);
                responseCookies.Set(Const.TestRedirectUri, this.RedirectUri);
            }

            // nonce
            HttpContext.Session.SetString(Const.TestNonce, this.Nonce);
            responseCookies.Set(Const.TestNonce, this.Nonce);

            // code_verifier
            HttpContext.Session.SetString(Const.TestCodeVerifier, this.CodeVerifier);
            responseCookies.Set(Const.TestCodeVerifier, this.CodeVerifier);
        }
Exemplo n.º 2
0
        /// <summary>セッションタイムアウト検出用Cookieを削除</summary>
        /// <returns>セッションタイムアウト検出用Cookie(データ空)</returns>
        public static void DeleteCookieForSessionTimeoutDetection()
        {
            // Cookie生成(削除時は、空の値を指定)
            IResponseCookies responseCookies = MyHttpContext.Current.Response.Cookies;
            CookieOptions    cookieOptions   = new CookieOptions();

            // Path属性を設定
            string applicationPath = MyHttpContext.Current.Request.PathBase;

            if (applicationPath == "/")
            {
                // 「//」になってしまうので、「/」になるよう修正
                cookieOptions.Path = "/";
            }
            else
            {
                // 例えば「/WebForms_Sample」+「/」=「/WebForms_Sample/」となる。
                cookieOptions.Path = applicationPath + "/";
            }

            // ※ Request.ApplicationPathは、URLのホスト名以上のパス情報を含まず、
            // アプリケーション・ディレクトリより下のパス情報を含まない。

            // HttpOnly属性を設定
            cookieOptions.HttpOnly = true;

            // 設定
            responseCookies.Set(FxHttpCookieIndex.SESSION_TIMEOUT, "", cookieOptions);
        }
Exemplo n.º 3
0
        /// <summary>テスト用にパラメタを保存</summary>
        private void SaveSaml2Params()
        {
            // テスト用にパラメタを、Session, Cookieに保存
            // ・Session : サイト分割時
            // ・Cookie : 同一サイト時
            IResponseCookies responseCookies = MyHttpContext.Current.Response.Cookies;

            // client_id → Issuer
            HttpContext.Session.SetString(Const.TestClientId, this.ClientId);
            responseCookies.Set(Const.TestClientId, this.ClientId);

            // redirect_uri → AssertionConsumerService
            HttpContext.Session.SetString(Const.TestRedirectUri, this.RedirectUri);
            responseCookies.Set(Const.TestRedirectUri, this.RedirectUri);

            // state → RelayState
            HttpContext.Session.SetString(Const.TestState, this.State);
            responseCookies.Set(Const.TestState, this.State);
        }
Exemplo n.º 4
0
 public static void SetPassword(this IResponseCookies cookies, string value)
 {
     cookies.Set("Password", value);
 }
Exemplo n.º 5
0
 public static void SetAccount(this IResponseCookies cookies, string value)
 {
     cookies.Set("Account", value);
 }