2017-01-24 11 views
2

私のアプリケーションで安心して使用しようとしていますが、問題は認証できません。 Rest-Assuredフォームが正常に動作しない

は何も

form("admin", "admin", new FormAuthConfig("/", "j_username", "j_password")) 

次のオプションではありません、次のために、コードの上に 401エラーが出て働かない、私は同様に、以下のオプションを試してみました

baseURI = "http://localhost:8080/api"; 
given() 
     .auth().form("admin", "admin", new FormAuthConfig("/authentication/", "j_username", "j_password")) 
.when() 
     .get("/formAuth") 
     .then() 
     .log().all() 
     .statusCode(200); 

私がしようとしていますコードですログインページを解析できませんでした。ログインページでエラーをチェックするか、FormAuthConfigを指定してください。次のエラーが

.auth().form("admin", "admin", formAuthConfig().withAutoDetectionOfCsrf()) 

フォーム

<form class="form ng-pristine ng-valid" role="form" ng-submit="login($event)"> 
       <div class="form-group"> 
        <label for="username" translate="global.form.username" class="ng-scope">Login</label> 
        <input type="text" class="form-control ng-pristine ng-valid ng-touched" id="username" placeholder="Your login" ng-model="username" autocomplete="off"> 
       </div> 
       <div class="form-group"> 
        <label for="password" translate="login.form.password" class="ng-scope">Password</label> 
        <input type="password" class="form-control ng-pristine ng-untouched ng-valid" id="password" placeholder="Your password" ng-model="password"> 
       </div> 
       <div class="form-group"> 
        <label for="rememberMe"> 
         <input type="checkbox" id="rememberMe" ng-model="rememberMe" checked="" class="ng-pristine ng-untouched ng-valid"> 
         <span translate="login.form.rememberme" class="ng-scope">Automatic Login</span> 
        </label> 
       </div> 
       <button type="submit" class="btn btn-primary ng-scope" translate="login.form.button">Authenticate</button> 
      </form> 

ためのコードであり、次は郵便配達

URL: http://localhost:8080/api/authentication?cacheBuster=1485280599118 
parameter: j_username:admin 
j_password:admin 

答えて

0

何かがV3で壊れているようだを使用してキャプチャ出力です。 com.jayway.restassured 2.8.0からio.restassured 3.0.5に移行したとき、私は今日同じ問題を抱えていました。アップグレードをロールバックしただけで、もう一度作業しました:/

関連する問題