Exemplo n.º 1
0
        /*--------------------------------------------------------------------------------------------*/
        private static string OnAccessExecption(IApiRequest pReq, IApiResponse pResp, Exception pEx)
        {
            FabOauthError fabErr;

            if (pEx is OauthException)
            {
                fabErr = (pEx as OauthException).OauthError;
            }
            else
            {
                fabErr = FabOauthError.ForInternalServerError();
                Log.Fatal("Unhandled OAuth Access Exception", pEx);
            }

            pResp.Status = System.Net.HttpStatusCode.Forbidden;
            return(fabErr.ToJson());
        }
Exemplo n.º 2
0
        /*--------------------------------------------------------------------------------------------*/
        private static bool OnLoginException(IApiRequest pReq, IApiResponse pResp, Exception pEx)
        {
            FabOauthError fabErr;

            if (pEx is OauthException)
            {
                fabErr = (pEx as OauthException).OauthError;
            }
            else
            {
                fabErr = FabOauthError.ForInternalServerError();
                Log.Fatal("Unhandled OAuth Login Exception", pEx);
            }

            string redirUri = pReq.GetQueryValue(LoginRedirectUriParam, false);
            string state    = pReq.GetQueryValue(LoginStateParam, false);

            pResp.RedirectUrl = BuildRedirectUri(fabErr, redirUri, state);
            return(true);
        }