2017-02-27 27 views
0

下面是我的項目模擬基本的web應用程序的代碼片段如預期從URL http://myhost/show_document/sample.pdf閱讀PDF文件,將工作,對具有SSO我們需要這個網絡應用程序(讓我們增加了before_request裝飾功能,此網絡應用使得通過SSO網址是企業特定的任何請求之前驗證用戶的)認證單點登錄,其實現的,如下圖所示。403錯誤在訪問/ redirecging的URL,但工作在瀏覽器中細

from flask import Flask 
import flask 
app = Flask(__name__) 

@app.route('/') 
def home(): 
    return 'Hello, World!' 

@app.route('/show_document/<report_name>') 
def document(): 
     response = flask.make_response(data) // data is pdf object 
    report_name='sample.pdf' 
     response.headers['Content-Type'] = 'application/pdf' 
     response.headers['Content-Disposition']='inline; filename=report_name' 
    return response 

@app.before_request 
def sso_auth(): 
    return flask.redirect('https://ssologon-enteriprise.com/ssologinconfirm,html?target={0}'.format(urllib))// this browser redirect to java web application 

if __name__ == "__main__": 
    app.run() 
    # Running on http://myhost/ 

燒瓶內,基於Python的Web應用程序作爲expected.Let的發言權工作,例如,如果在任何URL用戶點擊或瀏覽它的工作原理如下。

steps 1) Browsing url or click on url http://myhost/show_document.pdf (It is Http) 
     2) url request will redirect to sso page(which is java based web app). It use Https header 
      3) once SSO login is successful it redirect to its parent(step 1 url) page which is python based with header as (http) 

我們的SSO工作正常,但每當從Outlook電子郵件身體網址用戶點擊)它給|||||| 403報警||||||和網頁沒有得到重新加載用戶在服務器日誌中獲取此錯誤警告。如果我們複製此網址並將關閉和打開(重啓),然後瀏覽器的網址正在按上述步驟有任何問題,我們面臨的問題,只有當我們從電子郵件正文點擊URL。請幫助解決這個問題,這是我的假設。

這是問題,因爲HTTP頭導航HTTP原始頁面級> HTTPS SSO頁> HTTP原始頁面的?或者是因爲SSO java代碼問題?或因爲從Outlook電子郵件點擊?任何人都面臨類似的問題?

感謝,在提前

回答

1

你傳遞

'https://ssologon-enteriprise.com/ssologinconfirm,html?target={0}.format(urllib)'字面上所以format位字符串中。

修復它像這樣(.format之前移動報價

'https://ssologon-enteriprise.com/ssologinconfirm,html?target={0}'.format(urllib) 
相關問題