How to login to spring secured API ?
See original GitHub issueThe developers have created the application with spring security and i need to login to that application.
These are the request mapping the application uses for further request :
@RestController
@RequestMapping("/service/billing")
Following is my code :
@Before
public void init(){
RestAssured.baseURI = "https://example.com";
RestAssured.port = 8080;
RestAssured.basePath = "/portal";
}
@Test
public void userAuthentication(){
given().
auth().form(userName, password, FormAuthConfig.springSecurity().
withLoggingEnabled(new LogConfig(captor,true))).
expect().
statusCode(200).body(equalTo("OK")).
when().
get("/service/billing");
}
In response, i get the HTML Page as Login Page, means the application not logged in successfully with assertion error. I tried with each and everything to get out of this. Used fromAuthconfig as mentioned above, but didn’t get though.
Can anybody help me on this? I am newbie to this rest assured api.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12
Top Results From Across the Web
Tutorial | Spring Security and Angular
In this tutorial we show some nice features of Spring Security, Spring Boot and Angular working together to provide a pleasant and secure...
Read more >Spring Security Form Login - Baeldung
This tutorial will focus on Login with Spring Security. We're going to build on top of the previous Spring MVC example, as that's...
Read more >Login and Registration REST API using Spring Boot, Spring ...
You will learn how to build login or sign-in and registration or signup REST API using Spring boot, Spring Security, Hibernate, MySQL database....
Read more >How to secure REST with Spring Security - InfoWorld
Provide a UI with a button that sends a request to a back-end endpoint. · Provide a username and password field for users...
Read more >Securing a Rest API with Spring Security - OctoPerf
Securing a Rest API with Spring Security · user-crud-api. The User crud API is responsible of storing users somewhere. · user-auth-api. The user- ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello guys,
There is no news regarding this issue?
I’m also having difficulties to fill the login form for this website -> https://www.themoviedb.org/login.
This is my code:
Also, I tried this one :
After numerous attempts applied these calls and worked:
Next steps I’ve checked location header and it was the one I expected