我剛剛通過激活器1.3.7遷移到Play 2.4.6。播放2.4(Java):張貼表單返回在IE11中未經授權,在Chrome中工作
我有一個安全的控制器,處理表單。表單提交在Chrome中運行良好,但在IE11中,http POST結果是403代碼(未授權)。我不明白爲什麼會發生這種情況。這是一個間歇性的問題:連接相同的用戶,有時郵件有效,有時不會。我的應用程序(在其他頁面上)的其他帖子可以正常工作。 有人可以幫忙嗎?
我使用動作組合進行授權,並使用Play提供的自動csrf過濾器,這些過濾器在play 2.3下都可以很好地工作。他們也在Chrome中使用2.4.6,我遵循了CSRF configuration的步驟......我需要讓它在IE中工作,因爲我的用戶羣。
這裏是控制器:
@play.mvc.Security.Authenticated(Secured.class)
@Authorize(minLevel=PermissionLevel.VENDOR)
public class SoumRapideFlexible extends Controller {
...
public static Result save(){
Form<SoumFlex> boundForm = soumflexForm.bindFromRequest();
if(boundForm.hasErrors()){
return badRequest(page.render(boundForm));
}
... // else do stuff with the Soumflex object
}
}
這裏是形式,從外表到本質:
@(myForm: Form[SoumFlex])
@import helper._
<!DOCTYPE html>
<html>
<head>
<script data-main="@routes.Assets.versioned("javascripts/main_soumflex")"
src="@routes.Assets.versioned("lib/requirejs/require.js")"></script>
</head>
<body>
@form(routes.SoumRapideFlexible.save(), 'class -> "form-horizontal") {
@CSRF.formField
<div class="form-group">
<label class="col-md-2 control-label" for="inputProjet">Projet</label>
<div class="col-md-4">
<input type="text" class="form-control" id="inputProjet" name="inputProjet" placeholder="Nom du projet" required>
</div>
</div>
//... and many other form fields in similar fashion...
<input type="submit" class="btn btn-primary" id="soumettreSoum" value="Save">
</div> <!-- resumeSoum -->
}
</div>
</body>
</html>
這是因爲如果有時用戶憑據丟失或CSRF令牌不正確...任何人都有一個想法,爲什麼我會在IE11中有這樣的行爲?請幫忙。
無法增加很多洞察力,但在最近的測試中,我發現[swagger](http://editor.swagger.io/)對CSRF非常小心,因此從swagger進行測試幫助我解決了一些問題CSRF問題在我的apis。 – wwkudu