-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upload protected with pac4j auth error fix #361
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
coverage-report/src/test/java/org/jooby/issues/Issue361.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jooby.issues; | ||
|
||
import org.jooby.Upload; | ||
import org.jooby.pac4j.Auth; | ||
import org.jooby.test.ServerFeature; | ||
import org.junit.Test; | ||
|
||
public class Issue361 extends ServerFeature { | ||
|
||
{ | ||
use(new Auth().form()); | ||
|
||
get("/", () -> "OK"); | ||
|
||
post("/api/protected/upload", req -> { | ||
Upload file = req.file("myfile"); | ||
return file.name(); | ||
}); | ||
} | ||
|
||
@Test | ||
public void shouldPac4jAuthContextShouldNotFailWithFileUploads() throws Exception { | ||
request() | ||
.get("/auth?username=test&password=test") | ||
.expect("OK"); | ||
|
||
request() | ||
.post("/api/protected/upload") | ||
.multipart() | ||
.add("username", "test") | ||
.add("password", "test") | ||
.file("myfile", "<xml></xml>".getBytes(), "application/xml", "pom.xml") | ||
.expect(200); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters